Add ability to filter rules for `generate-docs` subcommand
Added rules filtering options, like in the rules subcommand.
To achieve reuse with rules subcommand:
- extracted filtering logic into
RulesFilter(and write tests) - extracted filtering command line parameters into
RulesFilterOptions: ParsableArguments
| 12 Messages | |
|---|---|
| :book: | Linting Aerial with this PR took 0.91s vs 0.91s on main (0% slower) |
| :book: | Linting Alamofire with this PR took 1.13s vs 1.14s on main (0% faster) |
| :book: | Linting Firefox with this PR took 5.28s vs 5.26s on main (0% slower) |
| :book: | Linting Kickstarter with this PR took 7.49s vs 7.66s on main (2% faster) |
| :book: | Linting Moya with this PR took 0.49s vs 0.49s on main (0% slower) |
| :book: | Linting Nimble with this PR took 0.47s vs 0.47s on main (0% slower) |
| :book: | Linting Quick with this PR took 0.21s vs 0.21s on main (0% slower) |
| :book: | Linting Realm with this PR took 9.8s vs 9.59s on main (2% slower) |
| :book: | Linting SourceKitten with this PR took 0.37s vs 0.37s on main (0% slower) |
| :book: | Linting Sourcery with this PR took 1.89s vs 1.88s on main (0% slower) |
| :book: | Linting Swift with this PR took 3.58s vs 3.54s on main (1% slower) |
| :book: | Linting WordPress with this PR took 8.76s vs 8.76s on main (0% slower) |
Generated by :no_entry_sign: Danger
Thanks for the PR! I'll review shortly but in the meantime, here's some unused imports that CI flagged:
Source/swiftlint/Commands/Common/RulesFilterOptions.swift:2:1: error: Unused Import Violation: All imported modules should be required to make the file compile. (unused_import)
Source/swiftlint/Commands/Common/RulesFilter.ExcludingOptions+RulesFilterOptions.swift:1:1: error: Unused Import Violation: All imported modules should be required to make the file compile. (unused_import)
Source/swiftlint/Helpers/RulesFilter.swift:1:1: error: Unused Import Violation: All imported modules should be required to make the file compile. (unused_import)
Thanks for quick feedback, I'll fix CI issues and mark "Ready for review" again
I fixed linter's warnings, but I don't understand reason for this error
Testing failed:
Command CompileSwiftSources failed with a nonzero exit code
No such module 'ArgumentParser'
Command CompileSwift failed with a nonzero exit code
Command EmitSwiftModule failed with a nonzero exit code
Testing cancelled because the build failed.
Just founded that it occurs when running xcodebuild test with this flag
OTHER_SWIFT_FLAGS="-D DISABLE_FOCUSED_EXAMPLES"
That's why we don't have tests for the CLI target.
Hm, I think this will be fixed by adding flag inheritance to the definition of OTHER_SWIFT_FLAGS using $(inherited)
Doesn't work
xcodebuild -scheme swiftlint test -destination "platform=macOS" OTHER_SWIFT_FLAGS='-D DISABLE_FOCUSED_EXAMPLES'
Works:
xcodebuild -scheme swiftlint test -destination "platform=macOS" OTHER_SWIFT_FLAGS='$(inherited) -D DISABLE_FOCUSED_EXAMPLES'
I will push this change to my branch to test this in CI
That helped ⬆️
Fantastic! To be honest I don't remember the exact reason why we didn't have CLI, it might have been something else that's since been resolved, or maybe I didn't configure things correctly. In any case, I'm glad you got it working here!
Yeah so SwiftPM wasn't able to do this until recently: https://github.com/apple/swift-package-manager/issues/4639
Thanks for your contributions here, @kattouf! I'm especially happy to see tests for the CLI target for the first time ever.