Commit Graph

557 Commits

Author SHA1 Message Date
JP Simard 6cafa08e70 release 0.9.2: Multiple Exhaust Codes 2016-03-15 15:29:14 -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
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 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 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 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 24e3adc355 make Configuration.configPath public 2016-02-10 17:26:06 -08:00
JP Simard 1af80bcc31 remove Configuration.disabledRules 2016-02-10 17:26:06 -08:00
JP Simard 1866edae77 adjust access control levels for many APIs in SwiftLintFramework
this is done in an effort to stabilize the API for SwiftLint 1.0.
2016-02-10 17:26:06 -08:00
JP Simard c662407c17 fix #522 2016-02-10 16:11:24 -08:00
JP Simard 7d0afb190b rename matchAndTokensPattern to rangesAndTokensMatching
also align regex pattern comments & fix indentation
2016-02-10 15:42:07 -08:00
Norio Nomura 83c008507b Improve performance of ColonRule
The duration of `ColonRule` on linting Carthage 0.13 is reduced from 1673ms to 515ms by Instruments.
2016-02-10 15:16:21 -08:00
Norio Nomura 03b237ecb2 Improve performance of FunctionParameterCountRule
The duration of `FunctionParameterCountRule` on linting Carthage 0.13 is reduced from 787ms to 208ms by Instruments.
2016-02-11 00:48:29 +09:00
JP Simard fe110a81ed add an integration test to ensure SwiftLint autocorrects successfully 2016-02-08 14:23:36 -08:00
JP Simard 31dc6b0a59 only correct legacy constructors if they're tokenized as identifiers 2016-02-08 14:22:02 -08:00
JP Simard 214d7069e2 udpate RuleList.configuredRulesWithDictionary now that ConfigurableRule is just Rule 2016-02-08 13:37:19 -08:00
JP Simard 714902ef01 treat single values as an array in the configuration dictionary 2016-02-08 13:24:14 -08:00