Commit Graph

76 Commits

Author SHA1 Message Date
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 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
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 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
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
Scott Hoyt 2f60e0b8f1 Removed unneeded rule disable. 2016-01-25 10:02:55 -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 2974a81c54 Switched out SyntaxKind(shortName:) implementation for something simpler. 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
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 d5598d4eae add missing imports needed by SPM 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
Marcelo Fabri b17b0f6e7d Minor refactoring 2016-01-21 22:33:21 -08:00
Marcelo Fabri d68161da96 Renaming functions to make clear that whitespace only lines are ignored too 2016-01-21 22:29:38 -08:00
Marcelo Fabri 3416217927 TypeBodyLengthRule should not count comment and whitespace lines 2016-01-21 22:29:38 -08:00
Marcelo Fabri 579872cd30 Handling multiline comments and correcting line count on violation reason 2016-01-14 20:26:20 -08:00
Marcelo Fabri 811cfd152e Clearing syntaxKindsByLinesCache 2016-01-14 20:25:51 -08:00
Marcelo Fabri ea33640296 Caching 2016-01-14 20:25:51 -08:00
Marcelo Fabri 72f401497d Refactoring 2016-01-14 20:25:51 -08:00
Marcelo Fabri 08ad3d333b Fix comparision when startLine or endLine is nil 2016-01-14 20:24:47 -08:00
Marcelo Fabri 07c076689b Address performance issues 2016-01-14 20:24:47 -08:00
Marcelo Fabri 57cf38a388 Fix identation 2016-01-14 20:24:47 -08:00
Marcelo Fabri 04b2510926 FunctionBodyLengthRule should not count comment lines 2016-01-14 20:24:47 -08:00
JP Simard 78ec5244f7 combine guards in rebuildAllDeclarationsByType 2016-01-13 16:54:30 -08:00
JP Simard 12c510c605 don't parse class declarations in rebuildAllDeclarationsByType
because this is only used in the missing docs rule which handles class
declarations by checking the "override" keyword
2016-01-13 16:44:14 -08:00
JP Simard 270fa90f3a make File.allDeclarationsByType lazier 2016-01-13 16:41:09 -08:00
JP Simard a5eb7c64fb [MissingDocsRule] skip inherited members when checking for missing docs 2016-01-13 16:41:08 -08:00
JP Simard 4c52163a70 add rule to encourage checking isEmpty over comparing count to zero 2016-01-13 15:41:25 -08:00
JP Simard e13907ead3 fix infinite regex search & 'where' false positive in ConditionalBindingCascadeRule 2016-01-12 18:35:31 -08:00
JP Simard 7268d373cc minor tweaks from #314 2016-01-12 11:41:33 -08:00
Scott Hoyt 647371517e Extracted arrayOf to Array extension and used to simplify VariableNameMinLengthRule.init?(config:). 2016-01-11 13:10:17 -08:00
Scott Hoyt 53efa3f23b Removed spurious selfs 2016-01-11 11:21:49 -08:00
Scott Hoyt 6d53ab152a Replaced YAML array flattening with simpler version. 2016-01-11 11:21:49 -08:00
Scott Hoyt bd6aab8478 Remove debug output. 2016-01-11 11:21:49 -08:00
Scott Hoyt 29cad2972a Removed TODOs 2016-01-11 11:21:49 -08:00
Scott Hoyt eab96555e5 Switch to non optional Configuration initialization from dictionary. 2016-01-11 11:18:54 -08:00
Scott Hoyt e797f9d282 Remove unnecessary Yaml extensions. 2016-01-11 11:18:54 -08:00
Scott Hoyt 2731c8ee55 Added flattening extensions to Yaml. 2016-01-11 11:14:54 -08:00
Scott Hoyt a81b228e5f Extracted Yaml extensions out of Configuration.swift 2016-01-11 11:14:54 -08:00
Norio Nomura 755619d3f8 Add SourceKit response cache for reducing calls to SourceKit
This depends on https://github.com/jpsim/SourceKitten/pull/135
By applying this, the duration of linting Carthage is reduced from:
```
swiftlint lint  27.85s user 1.98s system 77% cpu 38.538 total
```
to:
```
swiftlint lint  21.15s user 1.26s system 80% cpu 27.743 total
```
2016-01-09 23:49:07 +09:00
JP Simard d60a85aae0 make commands with modifiers work for violations with line-only locations 2016-01-04 13:25:57 -08:00
JP Simard 281a4dc587 no longer mirror some NSString methods in a String extension 2016-01-02 15:52:56 -08:00
Scott Hoyt f35f3d4a6c Revert "Silently load nested configurations."
This reverts commit d8c418e167.
2016-01-02 15:41:53 -08:00
Scott Hoyt 0d4fce9520 Silently load nested configurations. 2016-01-02 15:41:53 -08:00
Scott Hoyt bd26e4c3af Use new String extension. 2016-01-02 15:41:53 -08:00