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

RemoveUnused with -Ywarn-unused:<option> #1848

Open
bmarker opened this issue Aug 24, 2023 · 3 comments
Open

RemoveUnused with -Ywarn-unused:<option> #1848

bmarker opened this issue Aug 24, 2023 · 3 comments

Comments

@bmarker
Copy link

bmarker commented Aug 24, 2023

RemoveUnused and the removeUnused option for OrganizedImports don't seem to recognize the -Ywarn-unused:imports and similar options.

I had these from tpolecat:

  "-Ywarn-unused:implicits",           // Warn if an implicit parameter is unused.
  "-Ywarn-unused:imports",             // Warn if an import selector is not referenced.
  "-Ywarn-unused:locals",              // Warn if a local definition is unused.
  "-Ywarn-unused:params",              // Warn if a value parameter is unused.
  "-Ywarn-unused:patvars",             // Warn if a variable bound in a pattern is unused.
  "-Ywarn-unused:privates",            // Warn if a private member is unused.

But I still had to add -Ywarn-unused to get removing unused imports working.

I don't know if there's a check for the scalacOptions that could be adjusted or if it's more about how the rules work.

@bmarker
Copy link
Author

bmarker commented Aug 24, 2023

It looks like it's looking for a prefix to me :

private def warnUnusedPrefix = List("-Wunused", "-Ywarn-unused")

I also don't get a warning that the option is not set. However, nothing gets auto-fixed either.

@bmarker bmarker changed the title Remove unused with -Ywarn-unused:<option> RemoveUnused with -Ywarn-unused:<option> Aug 24, 2023
@bmarker
Copy link
Author

bmarker commented Aug 24, 2023

I'm using -Xfatal-warnings and -Wconf:cat=unused:info. I wonder if it's the -Wconf that's specific to unused and not unused:imports.

@bjaglin
Copy link
Collaborator

bjaglin commented Aug 25, 2024

I'm using -Xfatal-warnings and -Wconf:cat=unused:info. I wonder if it's the -Wconf that's specific to unused and not unused:imports.

Could you provide a repro?

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