* Split cache into one file per configuration
* Only write cache files with changes
* Avoid converting from Data -> String -> Data when saving cache files
* Move empty check to for where
* Split cache changelog entry
* Reword changelog entry to better reflect impact
* #2441 - Pass custom rules identifiers to the enableRules function to consider custom rules of a parent of a nested configuration
* #2441 - Add custom rules merge
* #2441 - Fix line length violation
* #2441 - Add nested configutaion mocks with custom rules
* #2441 - Add nested configurations tests for custom rules
* #2441 - Disable function body length check
* #2441 - Update changelog
* Move changelog to appropriate position
* Split up and refactor Configuration.init to avoid being too long
* Add tests to LinuxMain.swift
* Remove redundant protocol conformances
Hashable implies Equatable
* Fix typo in changelog entry and add another fixed issue URL
* #2353 - Move violating modifiers search to a private function
* #2353 - Add offset and length to the ModifierDescription
* #2353 - Make modifier_oder rule correctable
* #2353 - Add modifier_oder rule correction tests
* #2353 - Upadte the changelog
* #2353 - Add missing Foundation import
* #2353 - Fix linux tests
* Small edits to ModifierOrderRule and changelog entry
* Add VerticalWhitespaceOpening/ClosingBraces rules with description
* Implement validate, correct & add rules to lists
* Fix minor issues & update docs
* Fix copy & paste issue
* Improve autocorrection + Cleanup triggering examples
* Update changelog with new rule entries
* Add more validation examples
* [CHANGELOG.md] Mark new rules as opt-in
* Point to exact location of violation + update tests
* Make rules severity configurable
* Fix issues after rebasing
* Fix issue with CHANGELOG.md
* Add more violating examples, improve pattern to catch more cases
* Move changelog entries to new version
* Fix issues after rebase
* Move Changelog entry to current master
* Fix failing tests
* Fixes after refactoring
* Fix changelog entry position
* Make range unicode-safe (as suggested by @jpsim)
* Share duplicate Dictionary extension code
This can be used for avoid "Test::Unit::AssertionFailedError" error in `libxpc.dylib` on calling `sourcekitd_send_request_sync` in sandbox environment.
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
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.
* Add LintableFilesVisitor
* Move LintCommand logic into LintOrAnalyzeCommand
to prepare for the upcoming analyze command
* Add AnalyzeCommand (not fully implemented yet in SwiftLintFramework)
* Add analyzerRules configuration member
* Add AnalyzerRule protocol
* Pass compiler arguments to validate/correct
* Add requiresFileOnDisk member to RuleDescription
This will be used by AnalyzerRules because they need a file on disk
to pass in the compiler arguments to SourceKit.
* Exclusively run AnalyzerRules when the Linter has compiler arguments
* Enable testing AnalyzerRules in TestHelpers
* Add ExplicitSelfRule
* Update documentation
* Fix `analyze --autocorrect`
* Improve performance of CompilerArgumentsExtractor
* Fix lint command actually running analyze
* Move File operations in TestHelpers into a private extension
* Add analyzer column to rules command and markdown documentation
* Use a Set literal
* Make AnalyzerRule inherit from OptInRule
* Mention analyzer_rules in readme
* Mention that analyzer rules are slow
The MIT license doesn't require that all files be prepended with this
licensing or copyright information. Realm confirmed that they're ok with this
change. This will enable some companies to contribute to SwiftLint and the
date & authorship information will remain accessible via git source control.