Closed Lutzifer closed 1 month ago
Hm ... so is this rule useful for initializers at all? Feels like valid findings would be rare.
I think it has its uses for initializers, but the chance of breaking the build is too high. If it was an opt-in-only rule it would be more clear which rule caused the issue. Also, not-autofixing the initializers and instead showing a warning only would allow it to easily disable the rule for this very initializer if the situation outlined in the stack overflow issue occurs.
Disabling the rule for a specific initializer should work anyway. Doesn't it?
As the rule has been available for the last two releases already, changing it to opt-in would be breaking and could lead to surprises. Not sure yet if we should do that.
Yeah, it works, but first you have to find out which of the rules caused your code to be deleted 🤪
The initializers have only been included with the latest release of some days ago by default as far as I can see.
The problem is that the rule implementation for autocorrect is not respecting the new affect_initializers
configuration (which defaults to false
). This means that linting behavior didn't change with the new release, but autocorrection did.
The problem is that the rule implementation for autocorrect is not respecting the new
affect_initializers
configuration (which defaults tofalse
). This means that linting behavior didn't change with the new release, but autocorrection did.
that explains what we experienced
The problem is that the rule implementation for autocorrect is not respecting the new
affect_initializers
configuration (which defaults tofalse
). This means that linting behavior didn't change with the new release, but autocorrection did.
Aha ... then this should be an easy fix.
New Issue Checklist
Describe the bug
In some cases (as can be seen in this Stack Overflow Issue: https://stackoverflow.com/a/28187653), it is necessary to reimplement initializers.
As these reimplementations are considered "unneeded" by SwiftLint, they are deleted.
"unneeded_override" could be made optional to avoid breaking existing codebases with this when running swiftlint fix.