Commit Graph

338 Commits

Author SHA1 Message Date
JP Simard 8f22943ca1
release 0.39.1 2020-02-11 13:43:28 -08:00
Marcelo Fabri 5a4c3f143d release 0.39.0 2020-02-10 22:19:59 -08:00
David Harris 8c789bb3e2 feature: add config setting to exist successfully in case of no lintable (#2732)
files
2020-02-08 13:33:50 -08:00
Zev Eisenberg fcf848608e
Add Inline test failure messages (#3040)
* Add Example wrapper in order to display test failures inline when running in Xcode.
* Stop using Swift 5.1-only features so we can compile on Xcode 10.2.
* Wrap strings in Example.
* Add Changelog entry.
* Wrap all examples in Example struct.
* Better and more complete capturing of line numbers.
* Fix broken test.
* Better test traceability.
* Address or disable linting warnings.
* Add documentation comments.
* Disable linter for a few cases.
* Limit mutability and add copy-and-mutate utility functions.
* Limit scope of mutability.
2020-02-02 10:35:37 +02:00
JP Simard 76d44cff39
release 0.38.2 2020-01-08 10:35:08 -08:00
JP Simard d2643db495
[Docs] Build docs using jazzy (#3016)
* Add `.jazzy.yaml` configuration file
* Update `swiftlint generate-docs` to write docs to a directory rather than a single file
* Add jazzy to the Gemfile
* Run `bundle update`
* Add CI job to run jazzy automatically and publish to GitHub Pages

![swiftlint-jazzy](https://user-images.githubusercontent.com/474794/71799038-fcf4e180-3008-11ea-81fa-3eb9cf296506.gif)
2020-01-07 20:31:29 -08:00
Optional Endeavors 8fb900650b
Add support for showing only correctable rules, and a switch for ignoring the width of the terminal so full configuration detail is always shown. 2020-01-05 15:19:45 -08:00
JP Simard 6f6c9fed8c
release 0.38.1 2020-01-03 19:44:27 -08:00
JP Simard 8dc3e81193
release 0.38.0 2019-12-03 10:50:21 -08:00
Dave Lee 36e8d9f581 Add support for compilation databases (#2962)
* Add --compile-commands flag

* Implement support for --compile-commands

* Turns out you can't use yaml to read compile_commands.json

* refactor all the things

* Add changelog entry

* formatting

* Add comment and typealiases

* typo

* fix bool logic

* support directory field in compile commands

* remove "directory" field support

* filter compilation database args too

* Remove initial `swiftc` from args

* grammar
2019-12-03 10:36:18 -08:00
JP Simard 36775cce86
release 0.37.0 2019-11-09 14:31:56 -08:00
JP Simard beaa2a8a87
Update Commandant and SourceKitten, drop Result (#2947) 2019-11-07 10:59:16 -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
JP Simard 652e5dd59c
release 0.36.0 2019-10-24 15:25:32 -07:00
JP Simard 3706f31fd5
Fix running analyze on Xcode 11 build outputs (#2912)
Xcode 11 started using _response files_ [0] to avoid exceeding command
line length limits. For SwiftLint's analyzer rules to find which
compiler arguments are needed for a given file being analyzed, we first
need to expand these response files to their contents.

This was ported over from https://github.com/jpsim/SourceKitten/pull/613

[0]: https://github.com/apple/swift/pull/16362
2019-10-19 22:19:44 -07:00
JP Simard 8dc8421a49
release 0.35.0 2019-09-03 10:07:31 -04:00
Marcelo Fabri 3879151abf Enable some opt-in rules (#2801) 2019-08-28 14:49:23 -07:00
JP Simard e312b06f71
Fix `swiftlint rules` output table formatting (#2828)
Fixes https://github.com/realm/SwiftLint/issues/2787

Broken since https://github.com/realm/SwiftLint/pull/2379
2019-07-28 16:12:27 -07:00
JP Simard 08946e65e5
release 0.34.0 2019-07-18 18:28:39 -07:00
JP Simard b7c1db7245 Fix duplicate path printing 2019-07-18 14:59:42 -07:00
JP Simard 08816840ef Re-add outputFilename 2019-07-18 14:59:42 -07:00
Elliott Williams 3d5239429e Add AnyCollectingRule and isCollecting
All CollectingRules implement AnyCollectingRule, which is used to check
whether a linter will perform any collections and only print the
"Collecting" log message if so.
2019-07-18 14:59:42 -07:00
Elliott Williams 97f8d4803d Break Configuration.visit into multiple functions and fix index bug
The post-collection visitor in `Configuration.visit` was iterating over
the total fileCount given, not just the files that could be collected.
This meant than when a file was skipped, the visitor would end up
referencing a linter past the end of its array, causing a crash.
2019-07-18 14:59:42 -07:00
Elliott Williams 7344732799 PR: Create File+Hashable, symlink Array+SwiftLint, fix nits 2019-07-18 14:59:42 -07:00
Elliott Williams c338f292c3 Make shim autorelease function generic over its return value 2019-07-18 14:59:42 -07:00
Elliott Williams 512e06a4e4 Update tests to compile and pass
Publicize Array extensions

Address linting violations
2019-07-18 14:59:42 -07:00
Elliott Williams b1ca533649 Add RuleStorage and a pre-linting stage to run collection
In order for rules to collect arbitrary information about all files
being linted, a shared RuleStorage instance is defined in each command
and passed into the linter.

Linting now requires two "passes": once to call collect and populate the
storage (rules that are non-collecting do nothing here), and again to
call validate. The old Linter factory now creates a Prelinter, which can
collect for a file and produce a Linter that orchestrates all the
traditional validation/collection logic.

This design enforces that a file is only validated once it has been
collected; in turn, the file-visiting loop ensures that all files are
collected before the first is validated, so that the storage is fully
populated.

Use storage-backed correct method

Crash if storage for a rule is accessed prematurely

Key FileInfo by File

Rename Prelinter to Linter and Linter to CollectedLinter

Clean up rule protocols such that rule-facing storage methods are actually called

Make RuleStorage a reference type to solve mutating data races
2019-07-18 14:59:42 -07:00
JP Simard ffd0804746
release 0.33.1 2019-07-08 08:54:53 -07:00
Keith Smiley 6ac0894a40 Print relative path for duplicate filenames (#2768)
In projects with multiple Swift targets, it's possible to have multiple
Swift files with the same name. In this case you can't differentiate
from the log, which one SwiftLint is printing about. Now in this case it
prints the relative (to your pwd) path of the file.
2019-07-08 06:56:04 -07:00
Marcelo Fabri 740e398f91 release 0.33.0 2019-06-02 09:54:05 -07:00
JP Simard 6534946fe3
release 0.32.0 2019-04-28 21:30:19 -07:00
JP Simard a97487f3e1
Refactor `Configuration.groupFiles(...)` for style and performance (#2707)
* Move changelog entry to appropriate section

* Refactor file exclusion from groupedFiles for performance and style
2019-04-07 16:59:44 -07:00
Dylan Bruschi 9396a0a32b Fix bug where nested configuration excluded files are ignored (#2648)
Fixes #2447

When SwiftLint is linting files in `visitLintableFiles` in `Configuration+CommandLine`, it:

1. Gathers all lintable files in `getFiles`. This is where the exclusion of files occurs based on the parent configuration's exclusion list.
2. These files are grouped by their specific configuration in `groupFiles`. This is where configurations for each available file are determined (and if nested configurations exist, merged). After these configurations are determined and the files are grouped accordingly, no more files are excluded from the lintable files list. Even though a file's configuration thinks it should be excluded, these files are not removed from the list of lintable files, generating the bug.
3. Finally, each file is visited by the linter.

My solution is to skip files whose merged configurations specify they should be excluded in step 2 or `groupFiles`. Therefore, they will not be visited in step 3.
2019-04-07 15:43:29 -07:00
Marcelo Fabri 26c0048cf4 release 0.31.0 2019-02-28 15:01:30 -08:00
JP Simard f08c3e4239
Use firstIndex(where:) instead of index(where:) (#2600)
to silence a Swift 5 warning. This is compatible with Swift 4.2.
2019-01-27 20:19:16 -08:00
Marcelo Fabri b2d428a4e2 release 0.30.1 2019-01-23 11:08:50 -08: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
Marcelo Fabri d40fc8e452 release 0.30.0 2019-01-17 23:28:28 -08:00
JP Simard 0328f83db1
release 0.29.4 2019-01-16 14:29:24 -08:00
JP Simard bd0f78a501
release 0.29.3 2019-01-07 16:30:54 -08:00
JP Simard a21a8b3344
release 0.29.2 2018-12-23 20:32:25 -08:00
JP Simard c3d23ea771
release 0.29.1 2018-11-29 14:28:21 -08:00
Jim Hildensperger c3d72c2442
Only mark custom rules as enabled in your config when custom rules are configured. 2018-11-28 13:42:11 -08:00
JP Simard 8fc75e393b
release 0.29.0 2018-11-27 13:31:15 -08:00
JP Simard b64ead1a3c
release 0.28.2 2018-11-27 10:55:50 -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 4955c173a0
release 0.28.1 2018-11-18 15:41:26 -08:00
JP Simard 94dd8b4772
release 0.28.0 2018-11-13 22:41:00 -08:00
Ornithologist Coder 371e7b4995 Run format before autocorrect (#2383) 2018-09-02 14:35:39 -07:00