Commit Graph

495 Commits

Author SHA1 Message Date
JP Simard f3b6cc08f7 minor style change replacing '{ }' with '{}'
to stay consistent with other empty functions
2016-02-07 10:21:43 -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
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 2e56ac513a release 0.7.1 2016-01-26 11:27:27 -08: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