From 07e11561bf5535252a1addf1b211727f9286673e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Radzy=C5=84ski?= Date: Mon, 6 May 2024 11:28:00 +0200 Subject: [PATCH] Update dependencies & fix issues after update --- build.sbt | 28 +++++++++---------- project/build.properties | 2 +- project/plugins.sbt | 4 +-- .../main/scala/fix/JsonMacroFormatter.scala | 6 +++- tests/src/test/scala/fix/RuleSuite.scala | 4 +-- 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/build.sbt b/build.sbt index b449cd3..674d543 100644 --- a/build.sbt +++ b/build.sbt @@ -47,35 +47,35 @@ lazy val rules = project.settings( ) lazy val input = project.settings( - skip in publish := true, + publish/skip := true, libraryDependencies ++= Seq( - "io.circe" %% "circe-core" % "0.13.0", - "io.circe" %% "circe-literal" % "0.13.0", - "org.typelevel" %% "jawn-parser" % "1.0.0", + "io.circe" %% "circe-core" % "0.14.7", + "io.circe" %% "circe-literal" % "0.14.7", + "org.typelevel" %% "jawn-parser" % "1.5.1", ) ) lazy val output = project.settings( - skip in publish := true, + publish/skip := true, libraryDependencies ++= Seq( - "io.circe" %% "circe-core" % "0.13.0", - "io.circe" %% "circe-literal" % "0.13.0", - "org.typelevel" %% "jawn-parser" % "1.0.0", + "io.circe" %% "circe-core" % "0.14.7", + "io.circe" %% "circe-literal" % "0.14.7", + "org.typelevel" %% "jawn-parser" % "1.5.1", ) ) lazy val tests = project .settings( - skip in publish := true, + publish/skip := true, libraryDependencies += "ch.epfl.scala" % "scalafix-testkit" % V.scalafixVersion % Test cross CrossVersion.full, - compile.in(Compile) := - compile.in(Compile).dependsOn(compile.in(input, Compile)).value, + (Compile / compile) := + (Compile/compile).dependsOn(input / Compile / compile).value, scalafixTestkitOutputSourceDirectories := - sourceDirectories.in(output, Compile).value, + (output/ Compile / sourceDirectories).value, scalafixTestkitInputSourceDirectories := - sourceDirectories.in(input, Compile).value, + (input / Compile /sourceDirectories).value, scalafixTestkitInputClasspath := - fullClasspath.in(input, Compile).value + (input / Compile/ fullClasspath).value ) .dependsOn(rules) .enablePlugins(ScalafixTestkitPlugin) diff --git a/project/build.properties b/project/build.properties index 3161d21..04267b1 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.6.1 +sbt.version=1.9.9 diff --git a/project/plugins.sbt b/project/plugins.sbt index 6a4a07c..bd2102b 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ resolvers += Resolver.sonatypeRepo("releases") -addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.33") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.1") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1") diff --git a/rules/src/main/scala/fix/JsonMacroFormatter.scala b/rules/src/main/scala/fix/JsonMacroFormatter.scala index 6e57fd1..5579c2e 100644 --- a/rules/src/main/scala/fix/JsonMacroFormatter.scala +++ b/rules/src/main/scala/fix/JsonMacroFormatter.scala @@ -55,7 +55,11 @@ class JsonMacroFormatter extends SemanticRule("fix.JsonMacroFormatter") { def replaceReplacementStrings(json: Json): String = { val formatted = indent(json.spaces2, t.pos.startColumn).trim val newJson = terms.foldLeft(formatted)((str, term) => - str.replaceFirstLiterally(("\"" + unlikelyToBeMatchedString + "\""), s"$${$term}") + str.replaceFirstLiterally( + ("\"" + unlikelyToBeMatchedString + "\""), + if (term.toString().startsWith("{") && term.toString().endsWith("}")) s"$$$term" + else s"$${$term}", + ) ) newJson } diff --git a/tests/src/test/scala/fix/RuleSuite.scala b/tests/src/test/scala/fix/RuleSuite.scala index 5754bae..5ca361b 100644 --- a/tests/src/test/scala/fix/RuleSuite.scala +++ b/tests/src/test/scala/fix/RuleSuite.scala @@ -1,8 +1,8 @@ package fix -import org.scalatest.FunSpecLike +import org.scalatest.funsuite.AnyFunSuiteLike import scalafix.testkit.AbstractSemanticRuleSuite -class RuleSuite extends AbstractSemanticRuleSuite with FunSpecLike { +class RuleSuite extends AbstractSemanticRuleSuite with AnyFunSuiteLike { runAllTests() }