Commit Graph

291 Commits

Author SHA1 Message Date
Denis Lebedev 81e7f347ce Implement ParametersListLengthRule 2016-01-31 14:09:11 -08:00
Norio Nomura 5ebd64629a Improve performance of LineLengthRule
This depends on https://github.com/jpsim/SourceKitten/pull/152
The duration of linting Carthage 0.11 is reduced from 17sec to 16sec
SwiftLint(32b325b) with SourceKitten(0f54e19):
```
swiftlint lint --config ~/.swiftlint-test.yml  17.48s user 1.12s system 83% cpu 22.182 total
```
SwiftLint(this) with SourceKitten(d7f9266):
```
swiftlint lint --config ~/.swiftlint-test.yml  16.31s user 1.05s system 85% cpu 20.313 total
```
2016-01-31 13:57:37 -08:00
Norio Nomura 57025565d5 Improve performance of ColonRule
The duration of `ColonRule` on linting Carthage 0.11 is reduced from 2287ms to 1581ms by Instruments.
2016-01-30 22:10:38 +09:00
JP Simard b8ed788775 add more validation when setting a config dictionary
in SeverityLevelsConfig.setConfig
2016-01-28 10:39:15 -08:00
Robin Kunde f65b9d3e44 Disable SeverityLevelsConfig error ruleParam if only warning is set. This prevents the potential creation of invalid configs by implicit definition in Yaml. 2016-01-28 10:39:15 -08:00
JP Simard 611c4a8558 fix indentation in one ValidDocsRule example 2016-01-28 10:14:17 -08:00
Diogo Guimaraes 232873832b Fix validDocsRule 2016-01-28 15:29:56 +00:00
Norio Nomura 97392bdc94 Add NSRegularExpression.cached(pattern:)
All rules enabled linting Carthage 0.11 with this commit:
- Persistent Bytes on termination is reduced from 584.67MB to 556.62MB.
- Duration is reduced from 22sec to 21sec.

Related: #394
2016-01-27 14:33:19 +09:00
JP Simard 614c27ab1d optimize ForceUnwrappingRule 2016-01-26 10:49:14 -08:00
JP Simard 01832356ce make ForceUnwrappingRule conform to ConfigProviderRule 2016-01-26 10:49:05 -08:00
JP Simard b3c68474f7 fix indentation in ForceUnwrappingRule 2016-01-26 10:48:40 -08:00
Benjamin Otto fccd2796d1 Changed location for force unwrapping rule violation
- Changed the `Location` of the StyleViolation to point to the `!` that actually does the unwrapping
2016-01-26 10:48:40 -08:00
Benjamin Otto 5d02d70c63 Added a force unwrapping rule
The rule will create a warning for all force unwrappings
2016-01-26 10:48:31 -08:00
JP Simard eb89b89d4b make ValidDocsRule a bit more DRY 2016-01-26 09:54:24 -08:00
Diogo Guimaraes 0aaf01417b Fix ValidDocs rule 2016-01-26 13:54:56 +00:00
Norio Nomura d48bf364f8 Remove old VariableName*LengthRules.swift files
These are unused since ee3fe42.
2016-01-26 09:54:33 +09:00
Scott Hoyt 3aa5393b3d Fix typo. 2016-01-25 10:03:28 -08:00
Scott Hoyt 9ef5f165eb Made regex required for RegexConfig. 2016-01-25 07:26:31 -08:00
Scott Hoyt ccdd81af61 Switch guard early exit with if for CustomRules.validateFile. 2016-01-25 07:26:31 -08:00
Scott Hoyt c1406e10ce Added convenience initializer to NSRegularExpression for SwiftLint defaults. 2016-01-25 07:26:31 -08:00
Scott Hoyt b76a3d2ae6 Added tests. 2016-01-25 07:26:31 -08:00
Scott Hoyt 021affba73 Added the ability to set a rule name. 2016-01-25 07:26:31 -08:00
Scott Hoyt 08a7560881 Switch RegexConfig.matchTokens to RegexConfig.matchKinds. Properly reset set if key exists. 2016-01-25 07:26:31 -08:00
Scott Hoyt c6c088b3bc Fix broken tests by removing SwiftXCP import. 2016-01-25 07:26:31 -08:00
Scott Hoyt 923b4c4e7e Update RegexConfig to use a Set for matchTokens. Fixed CustomRules. 2016-01-25 07:26:31 -08:00
Scott Hoyt 615873adc2 Added to SyntaxKind+SwiftLint. RegexConfig now defaults to allKinds(). 2016-01-25 07:26:31 -08:00
Scott Hoyt b984d05e32 Use shortName instead of nickname. 2016-01-25 07:26:31 -08:00
Scott Hoyt fede0ccc2d Added convenience for RegexConfig.severity 2016-01-25 07:26:31 -08:00
Scott Hoyt 49bd5ae91f Use flatMap instead. 2016-01-25 07:26:31 -08:00
Scott Hoyt db10bff4d2 Fleshed out validateFile for CustomRules. 2016-01-25 07:26:31 -08:00
Scott Hoyt f463b9ba40 Filled out implementation details for RegexConfig.setConfig(). 2016-01-25 07:26:31 -08:00
Scott Hoyt f2cab3e296 Added CustomRulesConfig. 2016-01-25 07:26:31 -08:00
Scott Hoyt a266901216 Fixed typo. 2016-01-25 07:26:31 -08:00
Scott Hoyt 0177f09be6 Stub out RegexConfig. 2016-01-25 07:26:31 -08:00
Scott Hoyt 8cc5ba4f32 Stub out CustomRules. 2016-01-25 07:26:31 -08:00
JP Simard 4ae7f2fca9 use verifyRule to test FileLengthRule 2016-01-24 13:18:19 -08:00
JP Simard e0e0ec4e68 use verifyRule to test LineLengthRule 2016-01-24 13:15:31 -08:00
JP Simard a9f681955b use verifyRule to test TypeBodyLengthRule 2016-01-24 13:06:50 -08:00
JP Simard 2b286b67b7 refactor testTypeNames to use verifyRule 2016-01-24 12:44:17 -08:00
JP Simard 485c23fe7b make measureComplexity a bit more functional 2016-01-24 12:34:32 -08:00
JP Simard 34441da963 stylistic edits for CyclomaticComplexityRule 2016-01-24 12:34:32 -08:00
Denis Lebedev 2d4be3aca8 Cleanup rule code 2016-01-24 12:34:32 -08:00
Denis Lebedev dbb7938f54 Add POC of complexity rule 2016-01-24 12:34:32 -08:00
Scott Hoyt 75f2068299 Switch to if/early return for VariableNameRule. 2016-01-23 17:53:27 -08:00
Scott Hoyt 44ff8effc9 Reset VariableNameRule to if check on return as opposed to guard. 2016-01-23 17:42:13 -08:00
Scott Hoyt b145bf1212 Reset VariableNameRule to instantiating Location at the call site. 2016-01-23 17:42:13 -08:00
Scott Hoyt e2265cf9a7 Removed ViolationSeverity extension. Moved into a private function of SeverityConfig. 2016-01-23 17:42:13 -08:00
Scott Hoyt 95a7352760 Remove unnecessary Swift namespace for min and max calls. 2016-01-23 17:42:13 -08:00
Scott Hoyt 9f20fc2232 Switch SeverityConfig.setConfig to guard for better semantics. 2016-01-23 17:42:13 -08:00
Scott Hoyt 42a6e9fde4 Use guard in NameConfig.setConfig for better semantics. 2016-01-23 17:42:13 -08:00