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

UnusedMethodParameter with @unused annotation on constructor #901

Open
Darkttd opened this issue Nov 29, 2024 · 1 comment
Open

UnusedMethodParameter with @unused annotation on constructor #901

Darkttd opened this issue Nov 29, 2024 · 1 comment

Comments

@Darkttd
Copy link

Darkttd commented Nov 29, 2024

Hi there,
We introduced scapegoat recent, and we are trying to resolve warnings and errors on scapegoat results.
By the way, we found the case that we marked @unused annotation but it still marked warning with UnusedMethodParameter

class Foo(@annotation.unused x: Int)
/path/to/file/Foo.scala:21:30: [scapegoat] [UnusedMethodParameter] Unused parameter
  Unused constructor or method parameters should be removed.
  Unused constructor parameter (x).
class Foo(@annotation.unused x: Int)
                             ^

I believe that the annotation @unused should surpress UnusedMethodParameter warning.

@saeltz
Copy link
Collaborator

saeltz commented Nov 29, 2024

Hi,

the @annotation.unused is not supported. If you want to suppress the UnusedMethodParameter warning, you may use the following:
https://github.com/scapegoat-scala/scapegoat?tab=readme-ov-file#suppressing-warnings-by-method-or-class
Even better than marking as unused is of course removing that parameter, if possible.

So this is actually a feature request. We're happy to take contributions.
This inspection is also not supported on Scala 3 yet.

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