You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Add an include feature to the config so that common configuration could be shared
Actually, scalafix relies on metaconfig, which has precisely support for that through HOCON. So you should be able to create a common configuration file included by scala-specific configuration files, and use them with something like
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:
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:
include
feature to the config so that common configuration could be sharedThe text was updated successfully, but these errors were encountered: