Closed sdc-78 closed 1 year ago
While they are deprecated they are still valid rules. So I would expect them to be enabled by the all
key. Thus, I wouldn't change this behavior.
If you don't want the rules to be enabled, explicitly disable them. The warning appears no matter how the rules were enabled. If you like the rules, you enable them but you have to live with the warning. That's independent from the all
key.
I agree that deprecated rules should remain enabled by all
, as long as they still exist.
I'm only suggesting that they not be reported as deprecated, as they haven't been explicitly enabled.
Well, with all
a user has explicitly enabled them. That they are deprecated doesn't play a role. For a set of users they might still be useful.
For a set of users they might still be useful.
I actually hadn't thought of that. What type of use/users are you thinking of?
inert_defer
for example has been deprecated because the Swift compiler reports the same violation natively in recent versions. For people relying on an older Swift version, the rule still has it's benefit.
I don't think it would be too outrageous to have a command line argument that suppressed the deprecated rule warnings though.
In a private experimental branch I've got an implementation of a configuration "wizard" for SwiftLint, and there I marked all the deprecated rules with a DeprecatedRule
protocol, so that I can offer the user the option of disabling any deprecated rules.
A similar mechanism could be extended to support a command line argument to suppress the deprecation warnings ...
inert_defer
for example has been deprecated because the Swift compiler reports the same violation natively in recent versions. For people relying on an older Swift version, the rule still has it's benefit.
I agree that deprecated rules still may be useful and I never asked to stop enabling them!
what's the reason behind deprecating 'unused_capture_list'? Swift compiler doesn't seem to be reporting about that, so what's the catch?
Which version of the Swift compiler are you using and on which example?
Compiling
func f(x: Int) {
{ [x] in }()
}
prints out
main.swift:2:8: warning: capture 'x' was never used
{ [x] in }()
^
which unused_capture_list
is supposed to report as well and which thus draws the rule deprecated.
I'm using Swift 5.10. But as the rule got deprecated 18 months ago already, I assume that at least 5.8 should be complaining too.
New Issue Checklist
Describe the bug
SwiftLint gives warnings for deprecated rules that are implicitly enabled using the
all
rule :Environment