Open
Description
It is kind of a pain to use scalafix with an sbt project that is cross compiled for Scala 2 and 3 because scalafix has a hard fail if given a rule that isn't supported for that Scala version. For example:
[error] (web / Compile / scalafix) scalafix.sbt.InvalidArgument: 2 errors
[error] [E0] This rule is specific to Scala 2, because the compiler option `-Ywarn-unused` is not available yet in scala 3 To fix this error, remove RemoveUnused from .scalafix.conf
[error] [E1] This rule is specific to Scala 2, since procedure syntax is not supported in Scala 3. To fix this error, remove ProcedureSyntax from .scalafix.conf
Removing the rule from Scala 2 is unsatisfactory so the only other solution seems to be to have two separate configuration files. I didn't see any include functionality so this would have to be a copy/paste and both files have to be kept in sync.
It would be nice to have better support for having a single configuration that is used for multiple Scala versions.
A few thoughts come to mind:
- Change it to a warning instead of an error
- Add an
include
feature to the config so that common configuration could be shared - Make parts of the configuration conditional based on the Scala version