From 73df52fce6a56e8f3c7c7837bd37b75889e8152c Mon Sep 17 00:00:00 2001 From: "dwolla-oss-scala-steward[bot]" <212073+dwolla-oss-scala-steward[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 00:19:53 +0000 Subject: [PATCH 1/2] Update sbt to 1.10.1 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 04267b14a..ee4c672cd 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.9 +sbt.version=1.10.1 From 5642f2254e3f86289fbb2e7e6c36487cc6b20e47 Mon Sep 17 00:00:00 2001 From: Brian Holt Date: Wed, 24 Jul 2024 17:27:01 -0500 Subject: [PATCH 2/2] Update sbt-scalafix to 0.12.1 and revert PR#193 --- README.md | 19 +++++++++---------- project/AsyncUtilsBuildPlugin.scala | 2 +- project/plugins.sbt | 2 +- .../AddCatsTaglessInstancesTest.scala | 8 ++++---- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index cab89589a..c0b706730 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ Add Scalafix to your project's build by [following the instructions](https://sca 1. Add the Scalafix plugin to the project by adding this to `project/plugins.sbt`: ```scala - addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.0") + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.1") ``` 2. Enable SemanticDB by adding this to `build.sbt`: @@ -187,21 +187,14 @@ Add Scalafix to your project's build by [following the instructions](https://sca ThisBuild / semanticdbEnabled := true ThisBuild / semanticdbVersion := scalafixSemanticdb.revision ThisBuild / scalafixScalaBinaryVersion := CrossVersion.binaryScalaVersion(scalaVersion.value) - ThisBuild / scalafixDependencies += "com.dwolla" %% "finagle-tagless-scalafix" % "0.2.0" + ThisBuild / scalafixDependencies += "com.dwolla" %% "finagle-tagless-scalafix" % "1.1.1" ``` 3. Run the Scalafix rule automatically after generating the Thrift sources by adding this to `build.sbt`: ```scala Compile / scalafix / unmanagedSources := (Compile / sources).value - Compile / compile := Def.taskDyn { - val compileOutput = (Compile / compile).value - - Def.task { - (Compile / scalafix).toTask(" AddCatsTaglessInstances").value - compileOutput - } - }.value + scalafixOnCompile := true libraryDependencies ++= { val catsTaglessV = "0.14.0" Seq( @@ -211,6 +204,12 @@ Add Scalafix to your project's build by [following the instructions](https://sca } ``` + and adding this to `.scalafix.conf`: + + ```hocon + triggered.rules = [ AddCatsTaglessInstances ] + ``` + ### `AddCatsTaglessInstances` The `AddCatsTaglessInstances` rule finds generated Thrift service traits and adds implicit instances of diff --git a/project/AsyncUtilsBuildPlugin.scala b/project/AsyncUtilsBuildPlugin.scala index 3eed96ac9..f88e36193 100644 --- a/project/AsyncUtilsBuildPlugin.scala +++ b/project/AsyncUtilsBuildPlugin.scala @@ -63,7 +63,7 @@ object AsyncUtilsBuildPlugin extends AutoPlugin { private val supportedVersions = (currentTwitterVersion :: oldVersions).sorted.reverse - private val SCALA_2_13: String = "2.13.13" + private val SCALA_2_13: String = "2.13.14" private val SCALA_2_12 = "2.12.19" private val Scala2Versions: Seq[String] = Seq(SCALA_2_13, SCALA_2_12) diff --git a/project/plugins.sbt b/project/plugins.sbt index 26379c259..7c7e8b05a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,5 +3,5 @@ addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.7.2") addSbtPlugin("org.typelevel" % "sbt-typelevel-mergify" % "0.7.2") addSbtPlugin("org.typelevel" % "sbt-typelevel-settings" % "0.7.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") -addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.0") +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.1") addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.10.0") diff --git a/scalafix/rules/src/test/scala/com/dwolla/scrooge/scalafix/AddCatsTaglessInstancesTest.scala b/scalafix/rules/src/test/scala/com/dwolla/scrooge/scalafix/AddCatsTaglessInstancesTest.scala index feedc8a88..e36ecdb9a 100644 --- a/scalafix/rules/src/test/scala/com/dwolla/scrooge/scalafix/AddCatsTaglessInstancesTest.scala +++ b/scalafix/rules/src/test/scala/com/dwolla/scrooge/scalafix/AddCatsTaglessInstancesTest.scala @@ -4,7 +4,7 @@ import com.eed3si9n.expecty.Expecty.expect import munit.FunSuite import scalafix.Patch -import scala.meta._ +import scala.meta.* class AddCatsTaglessInstancesTest extends FunSuite { @@ -69,7 +69,7 @@ class AddCatsTaglessInstancesTest extends FunSuite { test("add SimpleService companion object with implicits") { val expectedPatchContent = - """Add(}, RightBrace(}) [467..468), } + """Add(}, RightBrace [467..468), } | | object SimpleService { | implicit def SimpleServiceInReaderT[F[_]]: SimpleService[({type Λ[β0] = _root_.cats.data.ReaderT[F, SimpleService[F], β0]})#Λ] = @@ -92,12 +92,12 @@ class AddCatsTaglessInstancesTest extends FunSuite { test("add replacement MethodPerEndpoint that extends SimpleService[Future]") { val expectedPatchContent = - """Add(}, RightBrace(}) [467..468), } + """Add(}, RightBrace [467..468), } | trait MethodPerEndpoint extends SimpleService[Future])""".stripMargin expect(patch.toString.contains(expectedPatchContent)) } - + test("the patches don't touch SimpleService2, which has already been fixed") { expect(!patch.toString.contains("SimpleService2")) expect(!patch.toString.contains(s"Add(Future, Future [${range("Future")(input.lastIndexOf)}), F)"))