SwiftLint icon indicating copy to clipboard operation
SwiftLint copied to clipboard

Fix `--only-rule` config issues

Open mildm8nnered opened this issue 1 year ago • 1 comments

Addresses #5711, where if there was no default configuration file, --only-rule would be ignored.

Replaces #5725

Previously, --only-rule some_rule was implemented as though the configuration was:

only_rules:
    - some_rule

This did not interact well when the top level configuration was absent, or with child configurations.

.onlyRule is now a new case on RulesMode, distinct from .only.

.onlyRule is somewhat equivalent to .allEnabled here - it's a special setting that can only be set from the command line.

Like .allEnabled, rules can still be disabled in a child configuration, so if there are specific directories that the rule should not run on, that is supported. This may be useful when using --fix with --only-rule

mildm8nnered avatar Aug 28 '24 01:08 mildm8nnered

17 Messages
:book: Linting Aerial with this PR took 0.92s vs 0.92s on main (0% slower)
:book: Linting Alamofire with this PR took 1.26s vs 1.27s on main (0% faster)
:book: Linting Brave with this PR took 7.17s vs 7.19s on main (0% faster)
:book: Linting DuckDuckGo with this PR took 5.05s vs 5.05s on main (0% slower)
:book: Linting Firefox with this PR took 10.56s vs 10.58s on main (0% faster)
:book: Linting Kickstarter with this PR took 9.69s vs 9.81s on main (1% faster)
:book: Linting Moya with this PR took 0.53s vs 0.53s on main (0% slower)
:book: Linting NetNewsWire with this PR took 2.62s vs 2.62s on main (0% slower)
:book: Linting Nimble with this PR took 0.77s vs 0.77s on main (0% slower)
:book: Linting PocketCasts with this PR took 8.53s vs 8.41s on main (1% slower)
:book: Linting Quick with this PR took 0.44s vs 0.46s on main (4% faster)
:book: Linting Realm with this PR took 4.49s vs 4.47s on main (0% slower)
:book: Linting Sourcery with this PR took 2.3s vs 2.31s on main (0% faster)
:book: Linting Swift with this PR took 4.48s vs 4.47s on main (0% slower)
:book: Linting VLC with this PR took 1.25s vs 1.25s on main (0% slower)
:book: Linting Wire with this PR took 17.44s vs 17.39s on main (0% slower)
:book: Linting WordPress with this PR took 11.51s vs 11.47s on main (0% slower)

Generated by :no_entry_sign: Danger

SwiftLintBot avatar Aug 28 '24 01:08 SwiftLintBot