nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: scala-steward-org/scala-steward
Pull request #1562 (2020-08-03 09:44:44)

Add scalafix rules for upcoming 10.2.0 release
Not yet release but will be soon, so it's good to have it ready before.


Patch:
diff --git a/modules/core/src/main/resources/scalafix-migrations.conf b/modules/core/src/main/resources/scalafix-migrations.conf
index c138c590..cead425c 100644
--- a/modules/core/src/main/resources/scalafix-migrations.conf
+++ b/modules/core/src/main/resources/scalafix-migrations.conf
@@ -89,5 +89,12 @@ migrations = [
     newVersion: "0.11.0",
     rewriteRules: ["https://gist.githubusercontent.com/REDNBLACK/9bc56ad71e4b01a63001339fa61b4cfd/raw/5f1cd32713c3235a83fe2d1d182bd71a001ef464/derevo-v0.11.0.scala"],
     doc: "https://github.com/manatki/derevo/blob/0.11.3/README.md#breaking-changes-in-011"
+  },
+  {
+    groupId: "com.typesafe.akka",
+    artifactIds: ["akka-http.*"],
+    newVersion: "10.2.0",
+    rewriteRules: ["dependency:MigrateToServerBuilder@com.typesafe.akka:akka-http-scalafix-rules:10.2.0"],
+    doc: "https://doc.akka.io/docs/akka-http/10.2/migration-guide/migration-guide-10.2.x.html#akka-http-10-1-x-10-2-0"
   }
 ]


Test patch:
diff --git a/modules/core/src/test/scala/org/scalasteward/core/scalafix/MigrationAlgTest.scala b/modules/core/src/test/scala/org/scalasteward/core/scalafix/MigrationAlgTest.scala
index a71aff74..6f48f292 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/scalafix/MigrationAlgTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/scalafix/MigrationAlgTest.scala
@@ -87,6 +87,6 @@ class MigrationAlgTest extends AnyFunSuite with Matchers {
   test("loadMigrations without extra file") {
     val migrations =
       MigrationAlg.loadMigrations[MockEff](None).runA(MockState.empty).unsafeRunSync()
-    migrations.size shouldBe 13
+    migrations.size shouldBe 14
   }
 }
Repository: scala-steward-org/scala-steward
Pull request #1599 (2020-09-03 15:48:08)

fix issue when value with version is a part of a long artifactId
reproduce #1586


Patch:
diff --git a/modules/core/src/main/scala/org/scalasteward/core/edit/UpdateHeuristic.scala b/modules/core/src/main/scala/org/scalasteward/core/edit/UpdateHeuristic.scala
index c7b9b138..deeb34cf 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/edit/UpdateHeuristic.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/edit/UpdateHeuristic.scala
@@ -171,7 +171,7 @@ object UpdateHeuristic {
   val sliding = UpdateHeuristic(
     name = "sliding",
     replaceVersion = defaultReplaceVersion(
-      _.mainArtifactId.toSeq.sliding(5).map(_.unwrap).take(5).filterNot(_ === "scala").toList
+      _.mainArtifactId.toSeq.sliding(5).map(_.unwrap).filterNot(_ === "scala").toList
     )
   )
 


Test patch:
diff --git a/modules/core/src/test/scala/org/scalasteward/core/edit/UpdateHeuristicTest.scala b/modules/core/src/test/scala/org/scalasteward/core/edit/UpdateHeuristicTest.scala
index 5a22bc7c..054a5d01 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/edit/UpdateHeuristicTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/edit/UpdateHeuristicTest.scala
@@ -442,6 +442,27 @@ class UpdateHeuristicTest extends AnyFunSuite with Matchers {
       ._1 shouldBe None
   }
 
+  test("cognito value for aws-java-sdk-cognitoidp artifact") {
+    val original = """val cognito       = "1.11.690" """
+    val expected = """val cognito       = "1.11.700" """
+    Single("com.amazonaws" % "aws-java-sdk-cognitoidp" % "1.11.690", Nel.of("1.11.700"))
+      .replaceVersionIn(original) shouldBe (Some(expected) -> UpdateHeuristic.sliding.name)
+  }
+
+  test("issue 1586 - tracing value for opentracing library") {
+    val original = """val tracing = "2.4.1" """
+    val expected = """val tracing = "2.5.0" """
+    Group(
+      "com.colisweb" % Nel.of(
+        "scala-opentracing-core",
+        "scala-opentracing-context",
+        "scala-opentracing-http4s-server-tapir"
+      ) % "2.4.1",
+      Nel.of("2.5.0")
+    )
+      .replaceVersionIn(original) shouldBe (Some(expected) -> UpdateHeuristic.sliding.name)
+  }
+
   test("fail on versions duplicated in a comment") {
     val original = """val scalajsJqueryVersion = "0.9.3" // val scalajsJqueryVersion = "0.9.3""""
     val expected = """val scalajsJqueryVersion = "0.9.3" // val scalajsJqueryVersion = "0.9.4""""
Repository: scala-steward-org/scala-steward
Pull request #1617 (2020-09-15 20:52:34)

Fix transitivity of Order[Version]
This fixes the broken transitivity of `Order[Version]` noticed in #1615 by removing cases in `Order[Component]`. It is concerning that that there are no test cases that were sensitive to the removed code. We should double-check if it is OK to remove that code or if we can write tests that are sensitive to that code.


Patch:
diff --git a/modules/core/src/main/scala/org/scalasteward/core/data/Version.scala b/modules/core/src/main/scala/org/scalasteward/core/data/Version.scala
index 311f09c0..019bde68 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/data/Version.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/data/Version.scala
@@ -121,7 +121,6 @@ object Version {
   object Component {
     final case class Numeric(value: String, startIndex: Int) extends Component {
       def toBigInt: BigInt = BigInt(value)
-      def isZero: Boolean = toBigInt === BigInt(0)
     }
     final case class Alpha(value: String, startIndex: Int) extends Component {
       def isPreReleaseIdent: Boolean = order < 0
@@ -200,8 +199,6 @@ object Version {
     implicit val componentOrder: Order[Component] =
       Order.from[Component] {
         case (n1: Numeric, n2: Numeric) => n1.toBigInt.compare(n2.toBigInt)
-        case (n: Numeric, a: Alpha)     => if (a.isPreReleaseIdent || !n.isZero) 1 else -1
-        case (a: Alpha, n: Numeric)     => if (a.isPreReleaseIdent || !n.isZero) -1 else 1
         case (_: Numeric, _)            => 1
         case (_, _: Numeric)            => -1
 


Test patch:
diff --git a/modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala b/modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala
index a67424df..90b5151e 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala
@@ -17,10 +17,16 @@ class VersionTest
     with ScalaCheckPropertyChecks {
   checkAll("Order[Version]", OrderTests[Version].order)
 
+  test("issue 1615: broken transitivity") {
+    val res = OrderTests[Version].laws.transitivity(Version(""), Version("0"), Version("X"))
+    res.lhs shouldBe res.rhs
+  }
+
   test("pairwise 1") {
     val versions = List(
       "0.1",
       "0-20170604",
+      "1.0e",
       "1.0.0-SNAP8",
       "1.0.0-M2",
       "1.0.0",
@@ -91,6 +97,7 @@ class VersionTest
 
   test("similar ordering as Coursier") {
     List(
+      ("1.0e", "1.0.0-SNAP8"),
       ("1.0.1e", "1.0.1"),
       ("42.2.9.jre7", "42.2.9"),
       ("42.2.9.jre7", "42.2.9.jre8"),
Repository: scala-steward-org/scala-steward
Pull request #1794 (2020-12-08 15:10:40)

Do not recognize dates as hashes in versions
A consequence of https://github.com/scala-steward-org/scala-steward/pull/1791
was that updates with dates in their versions were also prevented because
dates were recognized as hashes. This PR changes `hashIndex` such  that
strings that look like dates are not recognized as hashes.


Patch:
diff --git a/modules/core/src/main/scala/org/scalasteward/core/data/Version.scala b/modules/core/src/main/scala/org/scalasteward/core/data/Version.scala
index ce52fd30..1df2cb06 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/data/Version.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/data/Version.scala
@@ -79,7 +79,11 @@ final case class Version(value: String) {
     preReleaseIndex.isDefined
 
   private val hashIndex: Option[NonNegInt] =
-    """[-+]g?\p{XDigit}{6,}""".r.findFirstMatchIn(value).flatMap(m => NonNegInt.unapply(m.start))
+    """[-+]g?\p{XDigit}{6,}""".r
+      .findAllMatchIn(value)
+      .to(Iterable)
+      .find(m => !Version.startsWithDate(m.matched.drop(1)))
+      .flatMap(m => NonNegInt.unapply(m.start))
 
   private[this] val preReleaseIndex: Option[NonNegInt] = {
     val preReleaseIdentIndex = alnumComponents.collectFirst {
@@ -117,6 +121,16 @@ object Version {
     (l1.padTo(maxLength, elem), l2.padTo(maxLength, elem))
   }
 
+  private def startsWithDate(s: String): Boolean =
+    """(\d{4})(\d{2})(\d{2})""".r.findPrefixMatchOf(s).exists { m =>
+      val year = m.group(1).toInt
+      val month = m.group(2).toInt
+      val day = m.group(3).toInt
+      (year >= 1900 && year <= 2100) &&
+      (month >= 1 && month <= 12) &&
+      (day >= 1 && day <= 31)
+    }
+
   sealed trait Component extends Product with Serializable {
     def startIndex: Int
 


Test patch:
diff --git a/modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala b/modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala
index 39e2b53b..539cee10 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala
@@ -206,6 +206,8 @@ class VersionTest
       ("0.21.0-RC5", List("0.21.5", "0.21.6-RC1"), Some("0.21.6-RC1")),
       ("2.1.4.0-RC17", List("2.1.4.0-RC17+1-307f2f6c-SNAPSHOT"), None),
       ("v2-rev374-1.23.0", List("v2-rev20190917-1.30.3"), Some("v2-rev20190917-1.30.3")),
+      ("1.0.0-20201119", List("1.0.0-20201208"), Some("1.0.0-20201208")),
+      ("1.0.0-20201119-091040", List("1.0.0-20201208-143052"), Some("1.0.0-20201208-143052")),
       ("0.27.0-RC1", List("0.27.0-bin-20200826-2e58a66-NIGHTLY"), None)
     )
Repository: scala-steward-org/scala-steward
Pull request #1845 (2020-12-28 13:26:23)

Show the old version in oldVersionNote
Follow-up to #1843.


Patch:
diff --git a/modules/core/src/main/scala/org/scalasteward/core/vcs/data/NewPullRequestData.scala b/modules/core/src/main/scala/org/scalasteward/core/vcs/data/NewPullRequestData.scala
index cba090f7..9377478c 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/vcs/data/NewPullRequestData.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/vcs/data/NewPullRequestData.scala
@@ -143,7 +143,7 @@ object NewPullRequestData {
         Some(
           Details(
             "Files still referring to the old version number",
-            s"""The following files still refer to the old version number (${update.nextVersion}).
+            s"""The following files still refer to the old version number (${update.currentVersion}).
                |You might want to review and update them manually.
                |```
                |${files.mkString("\n")}


Test patch:
diff --git a/modules/core/src/test/scala/org/scalasteward/core/vcs/data/NewPullRequestDataTest.scala b/modules/core/src/test/scala/org/scalasteward/core/vcs/data/NewPullRequestDataTest.scala
index b57c6b07..f2437dbe 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/vcs/data/NewPullRequestDataTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/vcs/data/NewPullRequestDataTest.scala
@@ -200,7 +200,7 @@ class NewPullRequestDataTest extends FunSuite {
       """<details>
         |<summary>Files still referring to the old version number</summary>
         |
-        |The following files still refer to the old version number (0.2).
+        |The following files still refer to the old version number (0.1).
         |You might want to review and update them manually.
         |```
         |Readme.md
Repository: scala-steward-org/scala-steward
Pull request #1846 (2020-12-28 16:58:45)

Remove branch if PR is closed by project maintainer
Removes the remote update branch if we detect that a PR has been closed without merging.

See also #1793.


Patch:
diff --git a/modules/core/src/main/scala/org/scalasteward/core/nurture/NurtureAlg.scala b/modules/core/src/main/scala/org/scalasteward/core/nurture/NurtureAlg.scala
index 42f7c0cd..a662cc2b 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/nurture/NurtureAlg.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/nurture/NurtureAlg.scala
@@ -100,7 +100,8 @@ final class NurtureAlg[F[_]](config: Config)(implicit
       pullRequests <- vcsApiAlg.listPullRequests(data.repo, head, data.baseBranch)
       result <- pullRequests.headOption match {
         case Some(pr) if pr.isClosed =>
-          logger.info(s"PR ${pr.html_url} is closed") >> F.pure[ProcessResult](Ignored)
+          logger.info(s"PR ${pr.html_url} is closed") >>
+            gitAlg.removeBranch(data.repo, data.updateBranch).as(Ignored)
         case Some(pr) =>
           logger.info(s"Found PR ${pr.html_url}") >> updatePullRequest(data)
         case None =>
diff --git a/modules/core/src/main/scala/org/scalasteward/core/vcs/data/NewPullRequestData.scala b/modules/core/src/main/scala/org/scalasteward/core/vcs/data/NewPullRequestData.scala
index 9377478c..cba090f7 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/vcs/data/NewPullRequestData.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/vcs/data/NewPullRequestData.scala
@@ -143,7 +143,7 @@ object NewPullRequestData {
         Some(
           Details(
             "Files still referring to the old version number",
-            s"""The following files still refer to the old version number (${update.currentVersion}).
+            s"""The following files still refer to the old version number (${update.nextVersion}).
                |You might want to review and update them manually.
                |```
                |${files.mkString("\n")}


Test patch:
diff --git a/modules/core/src/test/scala/org/scalasteward/core/vcs/data/NewPullRequestDataTest.scala b/modules/core/src/test/scala/org/scalasteward/core/vcs/data/NewPullRequestDataTest.scala
index f2437dbe..b57c6b07 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/vcs/data/NewPullRequestDataTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/vcs/data/NewPullRequestDataTest.scala
@@ -200,7 +200,7 @@ class NewPullRequestDataTest extends FunSuite {
       """<details>
         |<summary>Files still referring to the old version number</summary>
         |
-        |The following files still refer to the old version number (0.1).
+        |The following files still refer to the old version number (0.2).
         |You might want to review and update them manually.
         |```
         |Readme.md