scalafix
scalafix copied to clipboard
RemoveUnused with -Ywarn-unused:<option>
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.
It looks like it's looking for a prefix to me : https://github.com/scalacenter/scalafix/blob/691a4f013bf92410ae3d29a21058fafb41817044/scalafix-rules/src/main/scala/scalafix/internal/rule/RemoveUnused.scala#L32
I also don't get a warning that the option is not set. However, nothing gets auto-fixed either.
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.