Commit Graph

689 Commits

Author SHA1 Message Date
Josh Friend a4d32cfa67 Don't trigger ClosingBraceRule across line breaks
Closes #592
2016-04-05 14:11:10 -04:00
Norio Nomura 0a6faafee7 Update SwiftyTextTable to 0.3.0 2016-03-19 10:05:18 +09:00
Norio Nomura 5caeb07342 [SPM] Move Source/SwiftLintFrameworkTests to Tests/SwiftLintFramework 2016-03-19 10:05:17 +09:00
JP Simard 6cafa08e70 release 0.9.2: Multiple Exhaust Codes 2016-03-15 15:29:14 -07:00
JP Simard e23516274f Merge pull request #567 from eaigner/master
Accept variable names starting with more than one capital letter
2016-03-14 17:36:25 -07:00
Erik Aigner 2c5b7a61d6 Accept variable names starting with more than one capital letter
The rule was modified to allow for names that start with multiple uppercase letters like XMLString or MIMEType.

Closes #566
2016-03-13 12:08:32 +01:00
Norio Nomura 76b083894f Fix printing duplicated violations bug that introduced by #584 2016-03-13 13:14:10 +09:00
JP Simard 681e993f08 break up LinterCommand's violation reporting
otherwise we get a function length exceeded violation
2016-03-09 20:46:04 -08:00
JP Simard d0590055b3 use multiple exit codes to distinguish between errors & strict warnings
Addresses #166.
2016-03-09 20:00:33 -08:00
JP Simard 0979aa3b64 Merge pull request #552 from realm/nn-rewrite-force-unwrapping-rule
Rewrite `ForceUnwrappingRule`
2016-03-09 19:53:44 -08:00
JP Simard 1166b697c2 fix docs typos 2016-03-09 19:43:52 -08:00
Neil Gall 1b4cf0c574 Do not overwrite files whose contents have not changed 2016-03-02 14:23:33 +00:00
Norio Nomura f62fe10372 Rewrite ForceUnwrappingRule
Add capture previous of "!" for:
- checking whether SyntaxKinds is comment, string, keyword or type identifier
- checking whether character is ")"
- checking whether SyntaxKinds is identifier or not
- SwiftDeclarationKind is one of some "Var*" and declaration containing "="

Add capture next of "!" for:
- checking SyntaxKinds is identifier

By applying this, the duration of linting Carthage 0.14 increase from 300ms to 380ms.
2016-02-21 22:35:56 +09:00
Norio Nomura c042258ac3 Add Structure.kindsFor(_:)
That returns array of tupple containing "key.kind" and "byteRange" from Structure that containing the byte offset.
2016-02-21 22:35:56 +09:00
Norio Nomura d5e37987df Change XCTestCase.verifyRule to show detail of non-triggering examples on failing test 2016-02-21 22:35:56 +09:00
Norio Nomura f80373f43d Add failing false positive examples to ForceUnwrappingRule's description
#546, #547
2016-02-21 22:35:56 +09:00
Norio Nomura 7c2c4ac270 Apply workaround for false positive of valid_docs
```
 SwiftLintFrameworkTests.IntegrationTests
  testSwiftLintLints, failed - Documented declarations should be valid.
```
That has been fixed on locally by https://github.com/jpsim/SourceKitten/pull/175
2016-02-19 18:17:20 +09:00
Norio Nomura 67be11ac92 Improve performance of SyntaxMap.tokensIn(_:)
On linting Carthage 0.14, the duration of `SyntaxMap.tokensIn(_:)` reduced from 145ms to 51ms.
2016-02-19 17:55:44 +09:00
Norio Nomura 704e7bde1d Add SyntaxMap.tokensIn(_:)
That returns array of SyntaxTokens intersecting with byte range.
2016-02-19 17:30:54 +09:00
Norio Nomura 01b06164e3 Apply corrections made by refined CommaRule on running IntegrationTests.testSwiftLintAutoCorrects() 2016-02-17 11:15:41 +09:00
Norio Nomura 32b98baf4c Exclude new line characters from trailing whitespace 2016-02-17 11:15:41 +09:00
Norio Nomura ecbfb46398 Add failing non trigger example
```swift
func abc(
  a: String,
  bcd: String
) {
}
```
2016-02-17 11:15:41 +09:00
Norio Nomura 6f17c93bd6 Add check trailing comment 2016-02-17 11:15:41 +09:00
Norio Nomura 78255e098b Add failing non trigger examples
```swift
func abc(
  a: String,  // comment
  bcd: String // comment
) {
}
```
2016-02-17 11:15:41 +09:00
Norio Nomura 8c35e1d3db Share regular expression between validateFile(_:) and correctFile(_:) in CommaRule 2016-02-17 11:15:41 +09:00
Norio Nomura be8f2ce63d Remove surplus map calls in rangesAndTokensMatching(_:) 2016-02-17 11:11:47 +09:00
Norio Nomura 193d4ef446 Simplify the regular expression in CommaRule.validateFile(_:) 2016-02-17 11:11:47 +09:00
Norio Nomura 1b2ba7ac88 Rewrite CommaRule.correctFile(_:)
Now corrections happen only on violations.
Because `assertCorrection(_:expected:)` expects one correction for each `corrections`,
and the rule added by 93e8e12 causes two corrections on previous logic.

Fix #466
2016-02-17 11:11:47 +09:00
Norio Nomura 8539953c09 Add failing correction example from #466 to CommaRule
https://github.com/realm/SwiftLint/issues/466#issuecomment-184474925
2016-02-17 11:11:47 +09:00
JP Simard 0d6ed5c71e release 0.9.1 2016-02-16 13:39:16 -08:00
Norio Nomura 669fbf09d0 Refine ForceUnwrappingRule
Fix #535
The duration of `ForceUnwrappingRule` on linting Carthage 0.14 is reduced from 1415ms to 339ms by Instruments.
2016-02-14 23:07:18 +09:00
Norio Nomura 0b1d54246a Add examples to nonTriggeringExamples of ForceUnwrappingRule 2016-02-14 23:00:37 +09:00
Norio Nomura fc2207521a Fix verifyRule() crashed on triggeringExample did not cause violation 2016-02-14 23:00:37 +09:00
Norio Nomura e09418add7 Add failing test from #535 to ForceUnwrappingRule 2016-02-14 23:00:37 +09:00
Norio Nomura 1716c6e108 Did not pass the IntegrationTests 2016-02-13 13:14:41 +09:00
Norio Nomura f9fc51bb57 Fix nested config traversing did not stop on root path 2016-02-13 13:08:58 +09:00
JP Simard 1234ae5dd9 release 0.9.0 2016-02-12 12:05:30 -08:00
JP Simard 79d796817c deprecate use_nested_configs: always consider nested configuration files 2016-02-12 10:55:20 -08:00
JP Simard 601470ab8f expand some instances of "config" to "configuration" 2016-02-12 10:53:36 -08:00
JP Simard 4ffb9358d0 rename CustomRulesConfig to CustomRulesConfiguration 2016-02-12 10:53:36 -08:00
JP Simard 144495306b rename rule configurations to expand "Config" to "Configuration" 2016-02-12 10:53:36 -08:00
JP Simard b2d954f655 rename ConfigType to ConfigurationType 2016-02-12 10:53:36 -08:00
JP Simard 5ad4e88ac0 move RuleConfigs to RuleConfigurations 2016-02-12 10:53:36 -08:00
JP Simard 7e07e813ca rename RuleConfig to RuleConfiguration 2016-02-12 10:53:36 -08:00
JP Simard 6befe7e5a4 expand many instances of "config" to "configuration" 2016-02-12 10:53:36 -08:00
JP Simard d9cd1d670a rename Rule.init(config:) to Rule.init(configuration:) 2016-02-12 10:53:36 -08:00
JP Simard db71448c47 rename Rule.configDescription to Rule.configurationDescription 2016-02-12 10:53:36 -08:00
JP Simard 3f4b993847 rename ConfigProviderRule to ConfigurationProviderRule 2016-02-12 10:53:36 -08:00
JP Simard 048c5dda84 expand "config" to "configuration" in Configuration.swift
with an exception being made for the "use_nested_configs" configuration key,
since that's already long enough as it is
2016-02-12 10:53:36 -08:00
JP Simard f468a245d4 Merge pull request #507 from realm/jp-trim-api
Trim API
2016-02-12 10:53:13 -08:00