File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
main/scala/org/scalasteward/core/edit/scalafix
test/scala/org/scalasteward/core/edit/scalafix Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 1717package org .scalasteward .core .edit .scalafix
1818
1919import cats .syntax .all ._
20+ import java .util .regex .Pattern
2021import org .scalasteward .core .data .Update
2122import org .scalasteward .core .edit .scalafix .ScalafixMigration .ExecutionOrder
2223
@@ -26,7 +27,8 @@ final class ScalafixMigrationsFinder(migrations: List[ScalafixMigration]) {
2627 .filter { migration =>
2728 update.groupId === migration.groupId &&
2829 migration.artifactIds.exists { re =>
29- update.artifactIds.exists(artifactId => re.r.findFirstIn(artifactId.name).isDefined)
30+ val pattern = Pattern .compile(re)
31+ update.artifactIds.exists(artifactId => pattern.matcher(artifactId.name).matches())
3032 } &&
3133 update.currentVersion < migration.newVersion &&
3234 update.nextVersion >= migration.newVersion
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import org.scalasteward.core.util.Nel
99class ScalafixMigrationsFinderTest extends FunSuite {
1010 test(" findMigrations" ) {
1111 val update = (" org.typelevel" .g % " cats-core" .a % " 2.1.0" %> " 2.2.0" ).single
12- val migrations = scalafixMigrationsFinder.findMigrations(update)
12+ val obtained = scalafixMigrationsFinder.findMigrations(update)
1313 val expected = (
1414 List (
1515 ScalafixMigration (
@@ -25,6 +25,13 @@ class ScalafixMigrationsFinderTest extends FunSuite {
2525 ),
2626 List ()
2727 )
28- assertEquals(migrations, expected)
28+ assertEquals(obtained, expected)
29+ }
30+
31+ test(" findMigrations: pattern must match whole artifactId" ) {
32+ val update = (" org.typelevel" .g % " log4cats-core" .a % " 2.1.1" %> " 2.4.0" ).single
33+ val obtained = scalafixMigrationsFinder.findMigrations(update)
34+ val expected = (List (), List ())
35+ assertEquals(obtained, expected)
2936 }
3037}
You can’t perform that action at this time.
0 commit comments