Commit Graph

20 Commits

Author SHA1 Message Date
Martin Redington ca43d2359b
Fix unit test configuration (#4847) 2023-03-30 22:46:31 +02:00
Jimmy Arts eda0d92f44
Make forceExclude work with directly specified files (#4609) 2022-12-22 21:15:08 +01:00
sarastro-nl d1a1485af6
enable glob for includePaths (#4093) 2022-08-15 13:54:49 +00:00
Frederick Pietschmann 4c5a3f0577 Add remote, parent & child configuration features 2020-11-20 23:08:37 +01:00
Mikhail Monakov fc0092dc8c
Add excluding by prefix option (#3345)
As we discussed here https://github.com/realm/SwiftLint/pull/3325 sometimes current excluding algorithm maybe slower than excluding paths by absolute prefix. So I added option for such cases.

Based on what I've checked it works faster for next scenarios:
- the number of input files is relatively small (e.g. when using `use-script-input-files`) and excluded directories contain relatively big number of lintable files
- the number of excluded directories relatively small (e.g. Pods + ThirdParty) and globs not used
2020-11-07 10:54:06 -08:00
JP Simard 37167a8a35
Add documentation comments to all public declarations (#3027) 2020-01-08 09:47:10 -08:00
Paul Taykalo d771d223e3 Remove unused imports 2019-11-07 16:20:18 +02:00
Paul Taykalo ac40778cb3 Use SwiftLintFile wrapper over the File 2019-11-07 15:19:17 +02:00
Marcelo Fabri 3879151abf Enable some opt-in rules (#2801) 2019-08-28 14:49:23 -07:00
Luis Valdés 80a44bcf8c Exclude files defined in `excluded` when using the `--use-script-input-files` and `--force-exclude` options (#2574) 2019-01-22 12:28:34 -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
Keith Smiley 97dc3b69e5
Rename function 2018-07-26 10:21:13 -07:00
Keith Smiley b21307530c
Move glob to its own struct 2018-07-26 10:21:13 -07:00
Keith Smiley a807d723e4
Add support for globs in excluded paths 2018-07-26 10:21:13 -07:00
JP Simard b83e0991b9
Remove all file headers
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.
2018-05-04 13:42:02 -07:00
Norio Nomura 2a0ac455bc
'flatMap' is deprecated: renamed to 'compactMap(_:)' 2018-04-08 13:28:09 +09:00
Ash Furrow 7ed962d1ee Adds force-exclusion config. 2018-03-22 09:42:56 -07:00
JP Simard 3a32d6b479
Speed up reading cached results by about 200%
also slightly speed up writing to the cache.

For example, on the Lyft codebase with 1,500 Swift files:

```bash
$ time swiftlint lint --quiet
swiftlint --quiet  3.53s user 0.27s system 388% cpu 0.979 total
$ rm -rf ~/Library/Caches/SwiftLint && time swiftlint lint --quiet
swiftlint --quiet  35.20s user 1.22s system 371% cpu 9.806 total
$ time swiftlint lint --quiet
swiftlint lint --quiet  0.90s user 0.13s system 218% cpu 0.472 total
$ rm -rf ~/Library/Caches/SwiftLint && time swiftlint lint --quiet
swiftlint lint --quiet  31.78s user 1.18s system 360% cpu 9.146 total
```
2017-10-19 23:17:01 -07:00
Marcelo Fabri a300409798 Support non Swift files in `--file` argument
Fixes #1721.
2017-08-07 23:10:04 +02:00
JP Simard 8f8e5d1fc2
move "lintable files" functionality to Configuration+LintableFiles 2017-07-17 11:45:32 -07:00