Commit Graph

4224 Commits

Author SHA1 Message Date
JP Simard eb8ee4601d
Migrate FallthroughRule to SwiftSyntax [skip ci] 2018-11-22 13:46:34 -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
JP Simard 94dd8b4772
release 0.28.0 2018-11-13 22:41:00 -08:00
JP Simard 27714d9770
Fix readme badge
We moved to CircleCI a looooooooong time ago
2018-11-13 22:39:26 -08:00
JP Simard 09cb3bae2d
Remove unused Foundation import (#2463) 2018-11-13 22:28:28 -08:00
JP Simard 8966d86c09
Update CircleCI jobs to Xcode 10.1 where possible (#2462)
Update CircleCI jobs to Xcode 10.1 where possible

And fix changelog formatting
2018-11-13 22:25:34 -08:00
Marcelo Fabri 83a2ca4be7
Merge pull request #2419 from yhkaplan/random
New Rule - Legacy Random
2018-10-13 22:58:50 -07:00
Joshua Kaplan 44b57ded29 Offset already proven to be not nil 2018-10-14 13:28:29 +09:00
Joshua Kaplan 1adb275050 Set is more efficient 2018-10-14 13:27:45 +09:00
Joshua Kaplan a3031aa4f3 Update Changelog with new rule name 2018-10-14 13:14:51 +09:00
Joshua Kaplan d40cfc0c90 Refactor rule to be AST rule 2018-10-06 16:03:37 +09:00
Joshua Kaplan 8b12806e9e Correct rule kind from 'lint' to 'idiomatic' 2018-10-06 12:04:28 +09:00
Joshua Kaplan 6eda1396d8 Rename random rule to legacy random rule 2018-10-06 12:02:21 +09:00
Marcelo Fabri 2c59827850
Merge pull request #2407 from marcelofabri/enable-static-operator
Enable static_operator opt-in rule in SwiftLint
2018-10-02 14:40:18 -07:00
Marcelo Fabri 34f513a9cb
Merge pull request #2430 from biboran/empty-count-fix
#2423 - Fix EmptyCountRule for binary, octal and hexadecimal integer literals
2018-10-02 14:28:19 -07:00
Timofey Solonin 21cd4e0db1 #2423 - Update documentation 2018-10-02 19:54:25 +03:00
Timofey Solonin e51646aa67 #2423 - Update changelog 2018-10-02 19:53:11 +03:00
Timofey Solonin e9d2552888 #2423 - Fix EmptyCountRule for binary, octal and hexadecimal integer literals 2018-10-02 19:47:52 +03:00
Marcelo Fabri 5bcaa613cc
Merge pull request #2428 from biboran/compiler-protocol-init-description
#2422 - Specify which literal rule was violated for CompilerProtocolInitRule
2018-10-01 17:23:57 -07:00
Timofey Solonin 1b71ae72c6 #2422 - Fix changelog 2018-10-01 19:41:50 +03:00
Timofey Solonin 78ebad7fd4 #2422 - Add changelog entry 2018-10-01 19:39:28 +03:00
Timofey Solonin 22be71e677 #2422 - Replace ruleDescription change with a StyleViolation reason field in CompilerProtocolInitRule 2018-10-01 18:28:52 +03:00
Timofey Solonin 3189d171c7 #2422 - Fix CI 2018-10-01 13:37:18 +03:00
Timofey Solonin 2cc4dca379 #2422 - Add CompilerProtocolInitRule violation unit test for ExpressibleByIntegerLiteral protocol 2018-10-01 12:34:01 +03:00
Timofey Solonin 5bf50c8920 #2422 - Specify which compiler protocol initialization rule was violated 2018-10-01 12:32:43 +03:00
Joshua Kaplan b173350969 Automatic changes to documentation, MasterRuleList, and tests 2018-09-30 14:55:29 +09:00
Joshua Kaplan 3d6030dfc0 Change rule implementation to use regex 2018-09-30 14:54:20 +09:00
yhkaplan 9acf8ba9a0 Delete unneeded todo 2018-09-27 23:55:59 +09:00
yhkaplan 1cedd0ccc6 Add Foundation import explicitly to get build working on Linux 2018-09-27 23:55:07 +09:00
Joshua Kaplan 4f6f667d1f Add to changelog 2018-09-27 00:43:26 +09:00
Joshua Kaplan d40889fd6c Add documentation 2018-09-27 00:23:30 +09:00
Joshua Kaplan 6cf052d0d8 Add tests 2018-09-27 00:22:41 +09:00
Joshua Kaplan 71b6def313 Add random rule 2018-09-27 00:21:36 +09:00
Marcelo Fabri 1f121b1ef7 Enable static_operator opt-in rule in SwiftLint 2018-09-16 20:33:28 -07:00