Repository: scala-steward-org/scala-steward
Pull request #3354 (2024-05-08 20:58:23)

Fix Scala 3 check
* the artifact contains a cross version, so only comparing the artifact name leads to the correct result 
* adapt lowest Scala 3 NEXT version

Tested with  https://github.com/playframework/play-json to prevent in the future pull requests like https://github.com/playframework/play-json/pull/1035


Patch:
diff --git a/modules/core/src/main/resources/artifact-migrations.v2.conf b/modules/core/src/main/resources/artifact-migrations.v2.conf
index 25de32e3..bb19ac4d 100644
--- a/modules/core/src/main/resources/artifact-migrations.v2.conf
+++ b/modules/core/src/main/resources/artifact-migrations.v2.conf
@@ -1204,4 +1204,139 @@ changes = [
     groupIdAfter = com.github.sbt
     artifactIdAfter = sbt-jupiter-interface
   },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-client-akka
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-client-core
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-client-esjava
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-client-pekko
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-client-sniffed
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-client-sttp
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-core
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-domain
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-effect-cats-2
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-effect-cats
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-effect-monix
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-effect-scalaz
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-effect-zio-1
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-effect-zio
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-handlers
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-http-streams
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-json-builder
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-json-circe
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-json-jackson
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-json-json4s
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-json-play
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-json-spray
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-json-zio-1
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-json-zio
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-streams-akka
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-streams-pekko
+  },
+  {
+    groupIdBefore = com.sksamuel.elastic4s
+    groupIdAfter = nl.gn0s1s
+    artifactIdAfter = elastic4s-testkit
+  },
 ]
diff --git a/modules/core/src/main/scala/org/scalasteward/core/data/package.scala b/modules/core/src/main/scala/org/scalasteward/core/data/package.scala
index 57c5dde6..3ab49444 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/data/package.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/data/package.scala
@@ -37,5 +37,5 @@ package object data {
   val scalaLangModules: List[(GroupId, ArtifactId)] =
     scala2LangModules ++ scala3LangModules
 
-  val scalaNextMinVersion: Version = Version("3.4.0")
+  val scalaNextMinVersion: Version = Version("3.4.0-NIGHTLY")
 }
diff --git a/modules/core/src/main/scala/org/scalasteward/core/update/FilterAlg.scala b/modules/core/src/main/scala/org/scalasteward/core/update/FilterAlg.scala
index 1440fef1..ca600df4 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/update/FilterAlg.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/update/FilterAlg.scala
@@ -79,13 +79,14 @@ object FilterAlg {
         val filteredVersions = update.newerVersions.filterNot(_ >= scalaNextMinVersion)
         if (filteredVersions.nonEmpty)
           Right(update.copy(newerVersions = Nel.fromListUnsafe(filteredVersions)))
-        else Left(IgnoreScalaNext(update))
+        else
+          Left(IgnoreScalaNext(update))
       }
     }
 
   def isScala3Lang(update: Update.ForArtifactId): Boolean =
     scala3LangModules.exists { case (g, a) =>
-      update.groupId == g && update.artifactIds.exists(_ == a)
+      update.groupId == g && update.artifactIds.exists(_.name == a.name)
     }
 
   private def globalFilter(update: Update.ForArtifactId, repoConfig: RepoConfig): FilterResult =


Test patch:
diff --git a/modules/core/src/test/scala/org/scalasteward/core/update/FilterAlgTest.scala b/modules/core/src/test/scala/org/scalasteward/core/update/FilterAlgTest.scala
index b1bd71da..c3065f4d 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/update/FilterAlgTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/update/FilterAlgTest.scala
@@ -254,17 +254,26 @@ class FilterAlgTest extends FunSuite {
 
   test("scalaLTSFilter: LTS, filter versions") {
     val update =
-      ("org.scala-lang".g % "scala3-compiler".a % "3.3.2" %> Nel.of("3.3.3", "3.4.0")).single
+      ("org.scala-lang".g % ("scala3-compiler", "scala3-compiler_3").a % "3.3.2" %> Nel.of(
+        "3.3.3",
+        "3.4.0"
+      )).single
     assertEquals(scalaLTSFilter(update), Right(update.copy(newerVersions = Nel.of("3.3.3".v))))
   }
 
   test("scalaLTSFilter: Next") {
-    val update = ("org.scala-lang".g % "scala3-compiler".a % "3.4.0" %> Nel.of("3.4.1")).single
+    val update =
+      ("org.scala-lang".g % ("scala3-compiler", "scala3-compiler_3").a % "3.4.0" %> Nel.of(
+        "3.4.1"
+      )).single
     assertEquals(scalaLTSFilter(update), Right(update))
   }
 
   test("isScala3Lang: true") {
-    val update = ("org.scala-lang".g % "scala3-compiler".a % "3.3.3" %> Nel.of("3.4.0")).single
+    val update =
+      ("org.scala-lang".g % ("scala3-compiler", "scala3-compiler_3").a % "3.3.3" %> Nel.of(
+        "3.4.0"
+      )).single
     assert(isScala3Lang(update))
   }