Commit Graph

48 Commits

Author SHA1 Message Date
JP Simard 170ad413f0 Lock accesses to assert handler storage
This fixes races seen "in the wild" causing crashes.
2017-11-09 12:28:45 -08:00
JP Simard aa73566b39 Convert Cache struct to a class
to avoid having to lock calls to mutating functions that don't
actually perform mutating operations.

This fixes races seen "in the wild" causing crashes.
2017-11-09 12:28:45 -08:00
Marcelo Fabri be341f90b9 Introduce queuedFatalError
`fatalError` prints the full path of the file, which leaks filesystem information from the machine that built the binary. Now that we release via CocoaPods, this is more critical.
2017-09-30 15:07:23 -03:00
JP Simard 48aaff433f remove unused code in File+Cache.swift 2017-08-08 09:13:32 -07:00
Marcelo Fabri 374731d92f Fix mark rule corrections generating invalid code in some cases
Apparently, we never invalidated the file cache when autocorrecting 😬
2017-07-23 02:08:15 +02:00
JP Simard e54dcae5b7 enable let_var_whitespace rule in SwiftLint itself
and refactor code in a few places to conform to the rule
2017-07-10 15:42:55 -07:00
JP Simard 29cdc86185 add some convenience members to SourceKit dictionaries 2017-01-22 11:00:57 -08:00
JP Simard 8906da640c perform Cache factory while locked 2017-01-02 09:52:01 -08:00
JP Simard 8a4671ecc5 make Cache thread-safe
and make some of its members private instead of fileprivate
2016-12-30 23:07:47 -08:00
JP Simard da555b8a3b minor spacing fixes 2016-12-30 18:21:11 -08:00
JP Simard 8ce031ff5f add substructure member to Dictionary+SwiftLint.swift 2016-12-23 12:35:01 -08:00
Marcelo Fabri 5cccc12eb7 Style changes because of the 120 length limit 2016-12-20 12:10:11 -02:00
Marcelo Fabri 1351fdb643 Fix violations for void_return rule 2016-12-13 10:41:08 -02:00
Marcelo Fabri 0afe9a8b19 Enabling more rules in SwiftLint itself 2016-12-10 19:12:40 -02:00
Marcelo Fabri 13b0cfe623 Fixing inconsistencies 2016-12-08 18:29:57 -02:00
JP Simard 19fad01b29 make all enum members lowercase to comply with Swift 3 API Guidelines 2016-12-01 22:16:21 -08:00
Norio Nomura 363bcf5c73 Merge branch 'master' into swift3.0
* master:
  add empty changelog section
  update Releasing.md with `brew bump-formula-pr`
  0.13.1: Heavy Cycle
  remove unused function dictFromKeyValuePairs
  add tests for reporterFromString(_:)
  small refactoring of SwitchCaseOnNewlineRule.swift

# Conflicts:
#	Source/SwiftLintFramework/Extensions/File+Cache.swift
#	Source/SwiftLintFramework/Rules/SwitchCaseOnNewlineRule.swift
2016-11-30 22:33:16 +09:00
Norio Nomura 636efb5b14 Merge commit 'aeb5d7ae442d6b590e7693a7214098a9328f951a' into swift3.0
* commit 'aeb5d7ae442d6b590e7693a7214098a9328f951a':
  Updating changelog
  Updating regex after PR feedback
  Adding SyntacticSugar rule

# Conflicts:
#	Source/SwiftLintFramework/Extensions/File+Cache.swift
2016-11-30 18:10:10 +09:00
JP Simard 2b1a3fab88 remove unused function dictFromKeyValuePairs 2016-11-28 23:12:54 -08:00
Marcelo Fabri c4b960000d Adding SyntacticSugar rule 2016-11-25 12:25:10 -08:00
Norio Nomura 40828dff03 Merge branch 'master' into swift3.0
* master: (41 commits)
  Fix formatting in CHANGELOG.md
  release 0.13.0
  Update CHANGELOG.md
  Fix check for trailing whitespace to return early
  Fix checks for some inline comments
  Replace check for comments to use SyntaxKind
  Add configuration for trailing_whitespace to ignore comments
  Unwanted space removed
  - Lint issues fixed
  Updated HTML Reporter
  PR feedback
  Add check on autocorrect for disabled range
  Use `utf8.count` instead of `utf16.count` to byte range
  Re-write `ExplicitInitRule` to `ASTRule`
  added ExplicitInitRule
  Updated CHANGELOG
  HTML Reporter added
  HTML Reporter added
  Adds information about SwiftLint plugin for AppCode into README.md
  added reasons why a new rule should be opt in
  ...

# Conflicts:
#	Source/SwiftLintFramework/Extensions/File+SwiftLint.swift
#	Source/SwiftLintFramework/Extensions/Structure+SwiftLint.swift
#	Source/SwiftLintFramework/Rules/ColonRule.swift
#	Source/SwiftLintFramework/Rules/CommaRule.swift
#	Source/SwiftLintFramework/Rules/LegacyCGGeometryFunctionsRule.swift
#	Source/SwiftLintFramework/Rules/LegacyConstantRule.swift
#	Source/SwiftLintFramework/Rules/LegacyConstructorRule.swift
#	Source/SwiftLintFramework/Rules/LegacyNSGeometryFunctionsRule.swift
#	Source/SwiftLintFramework/Rules/LineLengthRule.swift
#	Source/SwiftLintFramework/Rules/OperatorFunctionWhitespaceRule.swift
#	Source/SwiftLintFramework/Rules/ReturnArrowWhitespaceRule.swift
#	Source/SwiftLintFramework/Rules/RuleConfigurations/StatementPositionConfiguration.swift
#	Source/SwiftLintFramework/Rules/StatementPositionRule.swift
#	Source/SwiftLintFramework/Rules/TrailingWhitespaceRule.swift
#	Tests/SwiftLintFramework/RuleConfigurationTests.swift
2016-11-04 21:40:56 +09:00
Norio Nomura 3ff76e7ce8 Update SourceKitten 2016-11-04 20:24:21 +09:00
Norio Nomura c16efa15fb Merge pull request #807 from masters3d/closure-spacing
added closure-spacing-rule
2016-10-24 19:30:13 +09:00
Norio Nomura ec3f9d0c94 Fix line_length style violations, unused warnings 2016-10-13 22:40:45 +09:00
Norio Nomura b134008108 Merge branch 'master' into swift3.0
* master:
  Change `File.cacheKey` algorithm when `File.path` is nil

# Conflicts:
#	Source/SwiftLintFramework/Extensions/File+Cache.swift
2016-10-13 18:44:30 +09:00
Norio Nomura 7702493c6c Change File.cacheKey algorithm when File.path is nil
Sometime `ObjectIdentifier(self)` might collide between tests in SourceKitCrashTests.
The collision caused fail on `testAssertHandlerIsNotCalledOnNormalFile`.
2016-10-12 09:45:23 +09:00
Norio Nomura 8bf15f1dba Migrate to Swift 3.0 2016-10-09 01:09:50 +09:00
J Cheyo Jimenez 8bed233282 added closure-spacing-rule 2016-09-03 21:10:33 -07:00
Norio Nomura 2c19f759b2 Add File.assertHandler for testing
Because XCTest does not have functions that expecting assert happens.
That will be used only when sourcekitd failed, so performance regression by this is ignorable.
2016-04-13 18:40:25 +09:00
Norio Nomura e4a161132e Change File.sourcekitdFailed to settable and internal
settable is for testing.
2016-04-13 18:40:25 +09:00
Norio Nomura 43f75642f8 Change Cache<T> to working for file without path 2016-04-13 18:40:25 +09:00
Norio Nomura 350a85a3cb Request.sendMayThrow() has been changed to Request.failableSend() 2016-04-13 18:40:25 +09:00
Norio Nomura b0cda17c4c Move calling queueForRebuild.append(structure) to structureCache's factory closure
Because Swift does not allow `as? Structure?`.
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
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
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 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 ace0999154 update SourceKitten to 0.8.0 2016-01-22 19:19:15 -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
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
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 8a30cb2e3d organize Xcode project
make Extensions, Models & Protocols groups under SourceKittenFramework
2015-11-15 15:07:25 -08:00