scalafix
scalafix copied to clipboard
`--auto-suppress-linter-errors` shouldn't attempt to suppress `UnusedScalafixSuppression`
Take the following example file:
class Test {
def foo = 1 /* scalafix:ok */
}
Suppose that the /* scalafix:ok */
is unneeded, i.e. it is not suppressing anything. We run scalafix on the file with --auto-suppress-linter-errors
. Scalafix attempts to suppress the warning emitted by the UnusedScalafixSuppression
check, and we end up with
class Test {
def foo = 1 /* scalafix:ok *//* scalafix:ok */
}
We run it again, and now have four suppressions. Each time the number of (unused) suppressions doubles. This is basically opposite the intent of UnusedScalafixSuppression
and is not useful. It is, in fact, actively detrimental: whenever I add a new rule, I run scalafix with --auto-suppress-linter-errors
, and then do a global find-and-replace from /* scalafix:ok */
to /* scalafix:ok NameOfRule */
(on that note, it'd be awesome if the automatically added suppression comments would include the rule name themselves). Having new /* scalafix:ok */
s get added to all the unused suppressions, in addition to the violations of the new rule, makes that more complicated.
This wouldn't be such a problem if I just removed the unused suppressions, but that's also not an option. I run different rulesets under different circumstances, so suppressions of not included rules get flagged as unused even though they're still needed