Commit Graph

4256 Commits

Author SHA1 Message Date
JP Simard 61066c4c70
Run fallthrough rule tests on CI 2018-11-28 11:51:36 -08:00
JP Simard 60fc3af44c
Fixup 2018-11-28 10:44:29 -08:00
JP Simard 50f16d6907
Fixup 2018-11-28 10:40:04 -08:00
JP Simard d1df7af294
Deserialize syntax tree using byte tree 2018-11-28 10:39:44 -08:00
JP Simard 02113220d1
Migrate FallthroughRule to SwiftSyntax [skip ci] 2018-11-28 10:39:15 -08:00
Cihat Gündüz cf034c9dfb Multiline Brackets (#2302)
* Add new multiline_literal_brackets rule with examples

* Implement rule

* Add changelog entry

* Fix CHANGELOG and rule name

* Fix tests + Update stuff after rebasing

* Add more examples & fix whitespace issue

* Address feedback from @ornithocoder

* Add multiline rules for arguments and parameters

* Fix false positives in rule multiline_parameters_brackets

* Fix false positive for trailing closures in multiline_arguments_brackets

* Add nested examples to rule multiline_arguments_brackets

* Fix more false positives in multiline_arguments_brackets rule

* Use guard where appropriate instead of if

* Update generated artifacts after rebase

* Add CHANGELOG entry for all three new rules

* Move changelog entries to new version

* Fix changelog entries position

* Move new rules to correct subfolder

* Update Rules.md file contents

* Fixup changelog

* Refactor rules
2018-11-28 10:30:36 -08:00
Cihat Gündüz 38b0114951 Fix false positives on explicit_type_interface rule (#2426) 2018-11-28 09:08:03 -08:00
Cihat Gündüz 9d47c3471c Vertical whitespace between cases (#2292) 2018-11-28 08:34:10 -08:00
Marcelo Fabri 8f8cf84a10
Merge pull request #2490 from marcelofabri/bugfix-2489
Fix false positive in nimble_operator rule
2018-11-27 21:48:50 -08:00
Marcelo Fabri 85b61e7fcc Fix false positive in nimble_operator rule
Fixes #2489
2018-11-27 21:08:28 -08:00
dirtydanee c4e2a38643 Add "Redundant @objc Attribute" Rule (#2270) 2018-11-27 16:50:53 -08:00
JP Simard 60afab8085
Style nits 2018-11-27 15:27:52 -08:00
JP Simard f44d07d3da
Add empty changelog section 2018-11-27 14:04:39 -08:00
JP Simard 8fc75e393b
release 0.29.0 2018-11-27 13:31:15 -08:00
JP Simard d83143bf9b
Update latest version to support Swift 4.0-4.1.x 2018-11-27 13:19:52 -08:00
JP Simard 068d785ffd
Remove CryptoSwift from Carthage submodules 2018-11-27 13:18:10 -08:00
JP Simard a944808c8b
Default column to 1 in XcodeReporter output (#2488) 2018-11-27 13:00:01 -08:00
JP Simard 64c0b961d3
Fix changelog entry position 2018-11-27 12:32:44 -08:00
Dani Vela b58c4e35bb Add markdown reporter (#2486) 2018-11-27 12:31:12 -08:00
JP Simard 827410a4cd Remove BoolExtensionTests from LinuxMain.swift 2018-11-27 11:41:14 -08:00
JP Simard f6a1618394 Minor stylistic edits for homebrew integration tests
also fixup Package.resolved and BoolExtensionTests
2018-11-27 11:41:14 -08:00
Norio Nomura efea1b7bd8 Add `testSimulateHomebrewTest()` to `IntegrationTests`
Motivation:

Sometimes, Homebrew bottling CI fails because it runs in the sandbox.

Modifications:

Add `testSimulateHomebrewTest()` to `IntegrationTests` that simulates test in `homebrew-core/Formula/swiftlint.rb` within sandbox.

Result:

Confirm that a test equivalent to `brew test swiftlint` will pass in the sandbox before publishing to homebrew.
2018-11-27 11:41:14 -08:00
JP Simard b64ead1a3c
release 0.28.2 2018-11-27 10:55:50 -08:00
JP Simard fad2a85b0b
Update SourceKitten to 0.22.0 2018-11-27 10:55:50 -08:00
JP Simard 4893c2d112
Fix changelog entry position 2018-11-27 10:51:18 -08:00
Cihat Gündüz 7ac9efab0e Fix false positive on file_name rule with specific patterns (#2418)
* Add false positive failing test to file_name rule

* Fix false positive in file_name rule

* Add changelog entry

* Use correct name in changelog
2018-11-27 10:50:25 -08:00
JP Simard f220e03cbc
Apply formatting fixes to changelog 2018-11-26 17:44:45 -08:00
Dominic Freeston e962440815 Fix false positives for `explicit_init` when passing init as closure in multiline call (#2478)
* Ignore calls with `(` before .init

* Update rules documentation

* Update CHANGELOG.md

* Change multi-line string to single-line with explicit newlines
2018-11-26 17:44:11 -08:00
JP Simard 45dd66bae6
Remove CryptoSwift dependency if not needed (#2485) 2018-11-26 16:31:26 -08:00
JP Simard 4f8838ad0f
Pass '--sanitize=thread' for tsan CI job (#2482)
Now that we require Swift 4.2, we can use this.
2018-11-25 12:00:02 -08:00
JP Simard f135617bd2
Make tests pass with Xcode project or Swift Package Manager (#2481) 2018-11-24 20:02:52 -08:00
JP Simard 4f64fc2d15
Add changelog entries for 0.28.2 2018-11-24 11:38:39 -08:00
Timofey Solonin 9a216e96a0 #2471 - Fix false positive toggle_bool (#2479)
* #2471 - Fix false positive toggle_bool by using negative lookbehind on dot and word character

* #2471 - Update changelog
2018-11-24 11:18:27 -08:00
JP Simard d1109da326
Parallelize iterating over subpaths (#2475)
This has a very small performance improvement on multi-core machines
2018-11-21 22:38:05 -08:00
Norio Nomura ea171fbbf2
Add `SWIFTLINT_DISABLE_SOURCEKIT` environment variable (#2473)
This can be used for avoid "Test::Unit::AssertionFailedError" error in `libxpc.dylib` on calling `sourcekitd_send_request_sync` in sandbox environment.
2018-11-21 17:03:42 -08:00
JP Simard db2fbad7fd
Use CommonCrypto if available to compute MD5 hash (#2474)
It's significantly faster than CryptoSwift: 3% vs 19% of cached lint time for Lyft's iOS codebase.

### Before (CryptoSwift)

![CryptoSwift](https://user-images.githubusercontent.com/474794/48873531-3f2a7780-eda3-11e8-9cd9-c0ef796b061b.png)

### After (CommonCrypto)

![CommonCrypto](https://user-images.githubusercontent.com/474794/48873539-481b4900-eda3-11e8-8605-4fd009da3eb1.png)
2018-11-21 16:19:10 -08:00
JP Simard b9dc20cc57
Set .swift-version to 4.2.1 2018-11-21 14:28:41 -08:00
JP Simard 9363a3a947
Bump Swift version and migration version in Xcode project 2018-11-21 14:28:10 -08:00
Marcelo Fabri d1dbc31aa9
Merge pull request #2469 from marcelofabri/use-default-equatable-implementation
Use default Equatable and Hashable implementations
2018-11-20 11:25:47 -08:00
Marcelo Fabri fb9d8df8a3 Add back MARK 2018-11-20 10:32:20 -08:00
JP Simard d744ac53e2
Update SourceKitten to 0.21.3 (#2470) 2018-11-19 10:44:02 -08:00
Marcelo Fabri cf0c7b7b21 Use default Equatable and Hashable implementations 2018-11-19 09:51:12 -08:00
JP Simard 5901d3075f
Require Swift 4.2 (#2466)
This bumps the minimum version required to build SwiftLint to 4.2. The primary motivating factor to drop support for Swift 4.0-4.1.x is that SwiftLint now uses CryptoSwift, which requires 4.2.

* Add changelog entry

* Remove --allow-warnings flag from CocoaPods commands

* Update CryptoSwift to 0.13.0

* Migrate to Swift 4.2

* Remove CircleCI tests for Swift < 4.2

* Update English and Chinese README

Korean README doesn't yet have a version table like this.

* Update gems

* Add changelog entry for fixed compiler warnings

* Update CocoaPods to 1.6.0.beta.2

To work around https://github.com/CocoaPods/CocoaPods/issues/7708
2018-11-18 17:32:25 -08:00
JP Simard 265b4fdc60
Add empty changelog section 2018-11-18 15:57:19 -08:00
JP Simard 4955c173a0
release 0.28.1 2018-11-18 15:41:26 -08:00
JP Simard 99db1590b6
Add note about last release supporting building with Swift < 4.2 2018-11-18 15:35:19 -08:00
JP Simard d768897f1d
Improve performance of collecting files to lint and lint cache lookups (#2465)
Performance has gotten pretty bad for complex SwiftLint configurations like the one used for Lyft's iOS code base involving lots of files in the directories being linted, large configuration files and many nested configuration files.

Two main areas were particularly ripe for improvement were:

1. Collecting which files to lint
2. Lint cache lookups

### Collecting which files to lint

Improve this by:

* using an NSOrderedSet to remove excluded paths instead of `Array.filter`
* parallelizing calls to `filesToLint` for all paths to lint and exclude
* using `FileManager.subpaths(atPath:)` instead of `enumerator(atPath:)`

|Change|Before|After|Speed up|
|-|-|-|-|
|NSOrderedSet|2.438s|0.917s|2.659x|
|Parallel Flat Map|2.438s|2.248s|1.085x|
|Subpaths|0.939s|0.867s|1.083x|
|**Total**|**2.438s**|**0.720s**|**3.386x**|

### Lint cache lookups

By using an MD5 hash of the Configuration description from CryptoSwift as the cache key instead of instead the full description, we can drastically speed up cache lookups for projects with complex SwiftLint configurations. I think the dictionary lookup for very large string keys doesn't perform very well.

---

* Speed up Configuration.lintablePaths

* Improve cache lookup performance by up to 10x

By using an MD5 hash of the Configuration description from CryptoSwift
as the cache key instead of instead the full description.

* Add changelog entries

* Swift 4.0 & Linux compatibility

* os(Darwin) isn't a thing

* Allow warnings in pod lib lint

SwiftLint supports building with Swift 4.0 to 4.2.

There is no version of CryptoSwift to support both Swift 4.0 and
Swift 4.2.

So allow warnings for now. We'll make one more Swift 4.0 compatible
release, then we'll bump the build requirements to Swift 4.2 and
remove the `--allow-warnings` flag.
2018-11-18 14:39:02 -08:00
JP Simard 30808b154d
Publish with Swift 4.2 2018-11-13 23:13:16 -08:00
JP Simard 64fdb99d28
Add enhancements section 2018-11-13 23:10:54 -08:00
JP Simard cb38f86981
Add empty changelog section 2018-11-13 23:10:27 -08:00