Commit Graph

114 Commits

Author SHA1 Message Date
JP Simard c66c5c8df0 formatting fixes
found running `swiftlint autocorrect --format`
2016-05-29 14:58:28 -07:00
Brian Hardy 5c1d40ca87 Updates whitespace to avoid line length violation.
The shame, oh the shame.
2016-05-02 00:23:49 -04:00
Brian Hardy 88c0c8ba8e Improves error messaging for Configuration, particularly with YAML parsing. 2016-05-02 00:05:57 -04:00
Blaise Sarr 3e91e27843 Enable rule 2016-04-17 14:56:03 +02:00
Norio Nomura 9c0a2492e8 Refactor ASTRule and add SourceKitFreeRule
- Make `ASTRule` to generic and remove `ASTBaseRule`
- Add `SourceKitFreeRule` and remove `RuleDescription.needsSourceKit`
2016-04-16 22:32:53 +09:00
Norio Nomura ad50e35c4e Add ASTBaseRule
`ASTBaseRule` takes kind as `String` for supporting other than `SwiftDeclarationKind`.
`ASTRule` inherits `ASTBaseRule`.
2016-04-16 08:30:00 +09:00
Norio Nomura 5cc6d3243a On SourceKitd failed, continue linting the file by limited rules that does not use SourceKitd
Add `RuleDescription.needsSourceKit` indicating the rule needs SourceKit.
If `ASTRule` or `needsSourceKit` is true, skip linting if SourceKitd fails.
2016-04-13 18:40:25 +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 79d796817c deprecate use_nested_configs: always consider nested configuration files 2016-02-12 10:55:20 -08:00
JP Simard 7e07e813ca rename RuleConfig to RuleConfiguration 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 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 fe110a81ed add an integration test to ensure SwiftLint autocorrects successfully 2016-02-08 14:23:36 -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
JP Simard 5e118070ce log an error when supplying invalid keys in the configuration dictionary 2016-02-08 13:24:14 -08:00
JP Simard 09e9d62056 print deprecation warning for 'enabled_rules' to stderr rather than stdout
to follow the convention used elsewhere in the project as to not invalidate
the output structure from formatted violation reporters like json, csv &
checkstyle.
2016-02-08 13:24:14 -08:00
JP Simard 711f23a9b9 introduce private ConfigurationKey enum in Configuration.swift
this should replace all the hardcoded string literals representing configuration
dictionary keys.
2016-02-08 13:24:14 -08:00
JP Simard 70c1008591 use constant strings rather than literals in Configuration.swift 2016-02-08 13:24:14 -08:00
JP Simard a0524644f5 move Configuration.rulesFromDict to RuleList.configuredRulesWithDictionary 2016-02-08 13:24:13 -08:00
JP Simard 59da7f3ce9 add --quiet flag to lint and autocorrect commands
addresses #386
2016-02-08 13:21:40 -08:00
JP Simard 368ee9544a fold ConfigurableRule into Rule 2016-02-08 13:08:51 -08:00
JP Simard c4ed26c05c allow passing an optional --reporter parameter to swiftlint lint 2016-02-06 11:14:23 -08:00
Norio Nomura a583b8e22c Rename label of tuple
It fixes following error:
> Source/swiftlint/Commands/LintCommand.swift:35:27: error: cannot invoke 'appendContentsOf' with an argument list of type '([(rule: String, time: Double)])'
>                ruleTimes.appendContentsOf(currentRuleTimes)
>                          ^
>Source/swiftlint/Commands/LintCommand.swift:35:27: note: expected an argument list of type '(C)'
>                ruleTimes.appendContentsOf(currentRuleTimes)
>                          ^

It seems Swift does not allow label mismatch on that.
2016-02-01 13:23:55 +09:00
JP Simard 8522aaa937 fix MasterRuleList order 2016-01-31 14:09:11 -08:00
Denis Lebedev b9676eb58f Rename ParametersListLengthRule -> FunctionParameterCountRule 2016-01-31 14:09:11 -08:00
Denis Lebedev 81e7f347ce Implement ParametersListLengthRule 2016-01-31 14:09:11 -08:00
Norio Nomura fe6cdb2bdc Add calls invalidateCache() on every corrections in Linter.correct()
Cache entry should be invalidate on every corrections,
because caches and content may not match after corrections.
2016-01-30 15:46:47 +09:00
Daniel Beard 998bed9716 Add whitelist only rules 2016-01-29 13:55:31 -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 6a3c3bfa3b also benchmark rule times when running lint with --benchmark 2016-01-25 23:27:30 -08:00
JP Simard d8167e83d7 add --benchmark option to LintCommand
to benchmark how long each file took to lint
2016-01-25 23:27:30 -08:00
Scott Hoyt 45d8633514 Added CustomRules to masterRuleList. 2016-01-25 07:26:31 -08:00
Denis Lebedev dbb7938f54 Add POC of complexity rule 2016-01-24 12:34:32 -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 ddcde17f04 Add min and max length checking responsibilities to VariableNameRule. 2016-01-23 17:42:13 -08:00
Scott Hoyt 0b61c63937 Extracted Rule Configuration structs to own files. 2016-01-23 17:42:13 -08:00
Scott Hoyt ccbcb537b5 Convert ConfigurableRule to throwing init instead of failing. 2016-01-23 17:42:13 -08:00
JP Simard 61920d2ab7 avoid Swift 2.2 deprecations 2016-01-22 21:09:28 -08:00
JP Simard ace0999154 update SourceKitten to 0.8.0 2016-01-22 19:19:15 -08:00
JP Simard c9246542ad fix infinite recursion when using nested config files. Fixes #368 2016-01-21 12:49:04 -08:00
JP Simard 9acc4c56b3 rewrite Location.description to compile 25x faster
before: 1097.1ms
after: 44.2ms
2016-01-18 13:52:37 -08:00
Scott Hoyt e389aafa0c Removed ruleParametersFromArray. 2016-01-14 08:53:18 -08:00
Aaron McTavish 20dbbe81b7 Implement LegacyConstantRule
From #319

CGGeometry: Prefer struct-scope constants CGRect.infinite, CGRect.null,
etc. over global constants CGRectInfinite, CGRectNull, etc.
2016-01-13 17:17:35 -08:00
JP Simard 9eabd45ce5 add "Missing Docs" rule 2016-01-13 15:59:37 -08:00
JP Simard 4c52163a70 add rule to encourage checking isEmpty over comparing count to zero 2016-01-13 15:41:25 -08:00