Skip to content

Commit

Permalink
support upcoming 3.3.4 for unused warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bjaglin committed Feb 28, 2024
1 parent a005e01 commit b582487
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ object OrganizeImports {
scalaVersion: String
): Configured[Rule] = {
val hasCompilerSupport =
Seq("3.0", "3.1", "3.2", "3.3")
Seq("3.0", "3.1", "3.2", "3.3.0", "3.3.1", "3.3.2", "3.3.3")
.forall(v => !scalaVersion.startsWith(v))

val hasWarnUnused = hasCompilerSupport && {
Expand Down Expand Up @@ -916,12 +916,12 @@ object OrganizeImports {
"A Scala compiler option is required to use OrganizeImports with"
+ " \"OrganizeImports.removeUnused\" set to true. To fix this problem, update your"
+ " build to add `-Ywarn-unused` (2.12), `-Wunused:imports` (2.13), or"
+ " `-Wunused:import` (3.4+)."
+ " `-Wunused:import` (3.3.4+ or 3.4+)."
)
else
Configured.error(
"\"OrganizeImports.removeUnused\"" + s"is not supported on $scalaVersion as the compiler is"
+ " not providing enough information. Please upgrade the Scala compiler to 3.4.0 or greater."
+ " not providing enough information. Please upgrade the Scala compiler to 3.3.4+ or 3.4+."
+ " Otherwise, run the rule with \"OrganizeImports.removeUnused\" set to false"
+ " to organize imports while keeping potentially unused imports."
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class RemoveUnused(config: RemoveUnusedConfig)
private def warnUnusedString = List("-Xlint", "-Xlint:unused")
override def withConfiguration(config: Configuration): Configured[Rule] = {
val diagnosticsAvailableInSemanticdb =
Seq("3.0", "3.1", "3.2", "3.3")
Seq("3.0", "3.1", "3.2", "3.3.0", "3.3.1", "3.3.2", "3.3.3")
.forall(v => !config.scalaVersion.startsWith(v))

val hasWarnUnused = config.scalacOptions.exists(option =>
Expand All @@ -44,11 +44,11 @@ class RemoveUnused(config: RemoveUnusedConfig)
Configured.error(
"""|A Scala compiler option is required to use RemoveUnused. To fix this problem,
|update your build to add -Ywarn-unused (with 2.12), -Wunused (with 2.13), or
|-Wunused:all (with 3.4+)""".stripMargin
|-Wunused:all (with 3.3.4+ or 3.4+)""".stripMargin
)
} else if (!diagnosticsAvailableInSemanticdb) {
Configured.error(
"You must use a more recent version of the Scala 3 compiler (3.4+)"
"You must use a more recent version of the Scala 3 compiler (3.3.4+ or 3.4+)"
)
} else {
config.conf
Expand Down

0 comments on commit b582487

Please sign in to comment.