Commit Graph

431 Commits

Author SHA1 Message Date
Scott Hoyt 923b4c4e7e Update RegexConfig to use a Set for matchTokens. Fixed CustomRules. 2016-01-25 07:26:31 -08:00
Scott Hoyt 0a4602b3e6 Refactored matchPattern to expose a method for supplying pre-initialized regex. 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
Norio Nomura 5933e31228 Optimize File.allDeclarationsByType
It rebuilds `_allDeclarationsByType` incrementally.
By applying this, the duration of linting Carthage is reduced from:
```
swiftlint lint --config ~/.swiftlint-test.yml  23.05s user 1.85s system 82% cpu 30.338 total
```
to:
```
swiftlint lint --config ~/.swiftlint-test.yml  20.09s user 1.34s system 84% cpu 25.329 total
```
2016-01-25 22:45:22 +09:00
JP Simard 7eca6aa77c release 0.7.0 2016-01-24 14:30:05 -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 610782220c Make ConfigurationError marginally more useful by not squashing it in Configuration.rulesFromDict. 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
Scott Hoyt 6132d5d282 Provide default implementation for RuleConfig.isEqualTo when it is Equatable. 2016-01-23 17:42:13 -08:00
Scott Hoyt 123d06e585 Switch VariableNameRule to use a guard for early exit if name is excluded. 2016-01-23 17:42:13 -08:00
Scott Hoyt 284d4e1cca Extracted ViolationSeverity initialization via unnormalized String to extension. 2016-01-23 17:42:13 -08:00
Scott Hoyt 885b47d8e7 Extract severity function to ConfigProviderRule extension for better encapsulation. 2016-01-23 17:42:13 -08:00
Scott Hoyt 943ed306a3 Modified names for brevity. 2016-01-23 17:42:13 -08:00
Scott Hoyt f722bcf360 All Rules (with the exception of MissingDocs) now provide some severity configuration. 2016-01-23 17:42:13 -08:00
Scott Hoyt 7af4756e73 Added SeverityConfig and tests. 2016-01-23 17:42:13 -08:00
Scott Hoyt 989bac7ec8 Renamed SeverityLevelConfig to SeverityLevelsConfig. 2016-01-23 17:42:13 -08:00
Scott Hoyt 8ff15625c4 Added exclusions to TypeNameRule. 2016-01-23 17:42:13 -08:00
Scott Hoyt cd5f4570c6 Switched to Set for excluded for performance and semantics. 2016-01-23 17:42:13 -08:00
Scott Hoyt 1f13e1621a Renamed return nil to return .None for semantics. 2016-01-23 17:42:13 -08:00
Scott Hoyt 60546e4c0d Renamed violationSeverity to severity for brevity. 2016-01-23 17:42:13 -08:00
Scott Hoyt 3230c6413e Replaced things in rule configurations named configuration for config to save space. 2016-01-23 17:42:13 -08:00
Scott Hoyt 421aa6e4c8 Added tests for NameConfig. 2016-01-23 17:42:13 -08:00
Scott Hoyt a64f9eddbd SeverityLevelConfig stores levels as Ints now. 2016-01-23 17:42:13 -08:00
Scott Hoyt 53e30574e1 Extracted violationSeverity to NameConfig. 2016-01-23 17:42:13 -08:00
Scott Hoyt 20e8038a91 Changed min/max names to reflect that they belong to name length. 2016-01-23 17:42:13 -08:00
Scott Hoyt bf5a569104 Renamed MinMaxLengthConfig to NameConfig to reflect combined responsibilities. 2016-01-23 17:42:13 -08:00
Scott Hoyt d137dcdbf2 Remove VariableNameRuleConfig in leu of adding excluded to MinMaxLengthConfig. Reduced length of length violation message. 2016-01-23 17:42:13 -08:00
Scott Hoyt 810f813d70 Add min/max thresholds to MinMaxLengthConfig for convenience. 2016-01-23 17:42:13 -08:00