Commit Graph

43 Commits

Author SHA1 Message Date
JP Simard c66c5c8df0 formatting fixes
found running `swiftlint autocorrect --format`
2016-05-29 14:58:28 -07:00
Norio Nomura 3ae3bfef71 Add early returns by checking File.sourcekitdFailed 2016-04-13 18:40:25 +09:00
Norio Nomura d92b2d6037 Use Request.sendMayThrow() in SourceKittenFramework
For gaining advantage of using `sourcekitd_set_notification_handler()`,
we need to vacate main thread to `dispatch_main()`.
2016-04-13 18:40:25 +09:00
Neil Gall 1b4cf0c574 Do not overwrite files whose contents have not changed 2016-03-02 14:23:33 +00:00
Norio Nomura 704e7bde1d Add SyntaxMap.tokensIn(_:)
That returns array of SyntaxTokens intersecting with byte range.
2016-02-19 17:30:54 +09:00
Norio Nomura be8f2ce63d Remove surplus map calls in rangesAndTokensMatching(_:) 2016-02-17 11:11:47 +09: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 7d0afb190b rename matchAndTokensPattern to rangesAndTokensMatching
also align regex pattern comments & fix indentation
2016-02-10 15:42:07 -08:00
Norio Nomura 83c008507b Improve performance of ColonRule
The duration of `ColonRule` on linting Carthage 0.13 is reduced from 1673ms to 515ms by Instruments.
2016-02-10 15:16:21 -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 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 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 0a4602b3e6 Refactored matchPattern to expose a method for supplying pre-initialized regex. 2016-01-25 07:26:31 -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 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 e13907ead3 fix infinite regex search & 'where' false positive in ConditionalBindingCascadeRule 2016-01-12 18:35:31 -08: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 65f992d8fe Support command comment modifiers
addresses #222
2015-12-27 21:06:12 -05:00
JP Simard 8d529f1804 Fix multibyte handling in many rules 2015-12-24 20:59:15 -05:00
Yasuhiro Inami ff3dd5bea2 Minor update for File+SwiftLint.swift 2015-12-19 13:40:39 +09:00
Yasuhiro Inami d5908b04fb Add File.ruleEnabledViolatingRanges() 2015-12-19 13:19:02 +09:00
Norio Nomura b8ddf80b7f Apply reviews 2015-12-14 09:02:53 +09:00
Norio Nomura 8f802996bd Optimize File.matchPattern(_:) -> [(NSRange, [SyntaxKind])]
Change from converting match's position to converting token's position.
By applying this, duration of linting KeychainAccess is reduced from 752+sec(I can't wait completion) to 27sec.
2015-12-13 21:04:44 +09:00
JP Simard 4c771eb355 add File.append(_:) and File.write(_:) 2015-12-05 21:09:43 -08:00
JP Simard 008f85f3ac Fix issues with multi-byte characters. Fixes #234. 2015-12-03 14:49:44 -08:00
JP Simard 9cc9e64374 add Valid Docs rule 2015-11-29 21:58:16 -08:00
JP Simard 73896ee04c add force try rule 2015-11-17 16:51:37 -08:00
JP Simard ecb2a8bee5 refactor variable name rules 2015-11-17 16:13:06 -08:00
JP Simard c31f33b49e check isEmpty rather than test count against zero 2015-11-17 13:17:24 -08:00
JP Simard d269bde1fa allow trailing semicolons in comments 2015-11-17 11:41:02 -08:00
JP Simard 8a30cb2e3d organize Xcode project
make Extensions, Models & Protocols groups under SourceKittenFramework
2015-11-15 15:07:25 -08:00