Commit Graph

508 Commits

Author SHA1 Message Date
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 b7b4177dda Merge pull request #508 from realm/jp-improve-rules-table-configuration-description
make RulesCommand show a configuration description for all rules
2016-02-08 13:08:16 -08:00
Norio Nomura 94fabdd11d Add fflush(stdout) before fputs(…, stderr)
`Swift.print()` uses buffered stdout by calling `putchar(_:)`.
This avoids mixing strings from stdout and stderr.

fix #432
2016-02-08 10:26:49 +09:00
JP Simard 3ccfa5780d Merge pull request #499 from realm/jp-fix-statement-position
fix inconsistencies between violations & corrections in StatementPositionRule
2016-02-07 15:50:30 -08:00
JP Simard 71135c6a4b make RulesCommand show a configuration description for all rules 2016-02-07 10:40:51 -08:00
JP Simard f3b6cc08f7 minor style change replacing '{ }' with '{}'
to stay consistent with other empty functions
2016-02-07 10:21:43 -08:00
JP Simard f4105b4502 fix inconsistencies between violations & corrections in StatementPositionRule 2016-02-07 10:13:27 -08:00
Ankit Aggarwal 41f59d6004 Ignore case of keywords for valid_docs 2016-02-07 22:29:19 +05:30
JP Simard 422b4a0b0b fix wording for function parameter count rule
fixes #504
2016-02-06 18:55:16 -08:00
JP Simard 5d11862fce Merge pull request #495 from realm/jp-lint-command-reporter
allow passing an optional `--reporter` parameter to `swiftlint lint`
2016-02-06 14:58:27 -08:00
JP Simard c4ed26c05c allow passing an optional --reporter parameter to swiftlint lint 2016-02-06 11:14:23 -08:00
Norio Nomura 3e3bb7bb90 Optimize excludingPattern in violatingOpeningBraceRanges()
Fix #491
By applying this, on linting KeychainAccess:
from(0.8.0):
```
swiftlint lint --config ~/.swiftlint-test.yml  29.61s user 0.18s system 98% cpu 30.175 total
```
to:
```
swiftlint lint --config ~/.swiftlint-test.yml  1.92s user 0.06s system 91% cpu 2.160 total
```
2016-02-06 16:16:15 +09:00
Scott Hoyt e4d007d014 Version bump to 0.8.0 2016-02-05 19:35:07 -08:00
JP Simard b2a7b707ab print rule configuration 2016-02-03 10:31:53 -08:00
Scott Hoyt a723e146b4 Added corrections for if and multi-line if to OpeningBraceRule. 2016-02-02 17:16:13 -08:00
Scott Hoyt a8ba805f19 Added more triggering and non-triggering examples for OpeningBraceRule. 2016-02-02 17:16:13 -08:00
Scott Hoyt d17f5b9d92 Modified access level of matchPattern(_, excludingSyntaxKinds:, excludingPattern:) 2016-02-02 17:15:00 -08:00
Scott Hoyt 2a623e926e Eliminated unneeded local variable. 2016-02-02 17:15:00 -08:00
Scott Hoyt 9c910862b1 Modified exclusion regex for OpeningBraceRule. 2016-02-02 17:15:00 -08:00
Scott Hoyt ebaa6ec871 Increase performance by early return if matches isEmpty. 2016-02-02 17:15:00 -08:00
Scott Hoyt 0ee04c3fa3 Added exclusion pattern for matching patterns in a file. Added Array and NSRange extensions to support. Used this in OpeningBraceRule. 2016-02-02 17:15:00 -08:00
Denis Lebedev a87253b5bf Measure complexity of nested functions separately 2016-02-02 16:18:27 -08:00
Denis Lebedev 22668504db Do not use 1 as initial value for Cyclomatic complexity 2016-02-02 15:56:37 -08:00
Denis Lebedev 71db85724e Improve switch statement complexity measure 2016-02-02 15:56:33 -08:00
Daniel Beard 5667ab889c Handle multiple groups 2016-02-02 10:37:49 -08:00
Daniel Beard 4e7325fbd4 Fix trailing_semicolon autocorrect to handle more than one violation per line 2016-02-02 10:29:10 -08:00
Diogo Guimaraes e9a2f4acb7 Fix ValidDocs rule 2016-02-02 10:47:51 +00: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
Norio Nomura d365b1c55d Add import Foundation 2016-02-01 13:18:26 +09:00
JP Simard a47a1f3b71 minor stylistic changes to FunctionParameterCountRule 2016-01-31 14:14:52 -08: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 ed1d825677 Use substringWithByteRange for extracting substring 2016-01-31 14:09:11 -08:00
Denis Lebedev 084b0302fb Use byteOffset for Styleviolation construction 2016-01-31 14:09:11 -08:00
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 cd307cfe5a Improve performance of syntaxKindsByLine
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.05s user 1.05s system 85% cpu 20.051 total
```
2016-01-31 13:47:48 -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
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
Norio Nomura 28ae84600c Add missing calls responseCache.clear() to File.clearCaches() 2016-01-30 15:35:49 +09:00
Norio Nomura 01e3da0dd3 Add File.invalidateCache() that invalidate cache entry of the file 2016-01-30 15:34:22 +09:00
Daniel Beard 998bed9716 Add whitelist only rules 2016-01-29 13:55:31 -08:00
JP Simard 532c7d7ce7 release 0.7.2 2016-01-28 17:21:13 -08:00