Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--auto-suppress-linter-errors shouldn't attempt to suppress UnusedScalafixSuppression #2102

Open
coreywoodfield opened this issue Oct 11, 2024 · 0 comments

Comments

@coreywoodfield
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants