diff --git a/.scalafix.conf b/.scalafix.conf index 05b9013d..d75060ef 100644 --- a/.scalafix.conf +++ b/.scalafix.conf @@ -1,8 +1,10 @@ rules = [ + RemoveUnused, NoAutoTupling, DisableSyntax, LeakingImplicitClassVal, NoValInForComprehension, + ProcedureSyntax ] OrganizeImports { diff --git a/.scalafix3.conf b/.scalafix3.conf new file mode 100644 index 00000000..05b9013d --- /dev/null +++ b/.scalafix3.conf @@ -0,0 +1,19 @@ +rules = [ + NoAutoTupling, + DisableSyntax, + LeakingImplicitClassVal, + NoValInForComprehension, +] + +OrganizeImports { + coalesceToWildcardImportThreshold = 8 + expandRelative = true + groupedImports = Merge + importSelectorsOrder = SymbolsFirst + removeUnused = false + groups = [ + "java." + "*" + "scala." + ] +} diff --git a/build.sbt b/build.sbt index 9b00b9c7..aff439b4 100644 --- a/build.sbt +++ b/build.sbt @@ -38,6 +38,13 @@ ThisBuild / scalacOptions ++= Seq("-explaintypes") ++ { ThisBuild / scalafixDependencies += Dependencies.Plugins.organizeImports +scalafixConfig := { + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((3, _)) => Some((ThisBuild / baseDirectory).value / ".scalafix3.conf") + case _ => None + } +} + Test / parallelExecution := false Test / fork := true @@ -46,12 +53,10 @@ Global / onChangedBuildSource := ReloadOnSourceChanges libraryDependencies ++= all excludeDependencies ++= { - if (scalaBinaryVersion.value == "3") - Seq( - "com.typesafe.scala-logging" % "scala-logging_2.13", - "org.scala-lang.modules" % "scala-collection-compat_2.13" - ) - else Seq.empty + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((3, _)) => Dependencies.scala3Exclusions + case _ => Seq.empty + } } addCommandAlias("checkFix", "scalafixAll --check OrganizeImports; scalafixAll --check") diff --git a/project/Dependencies.scala b/project/Dependencies.scala index dd929052..8af87ce2 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -32,6 +32,11 @@ object Dependencies { val embeddedKafka = "io.github.embeddedkafka" %% "embedded-kafka" % "3.1.0" % Test cross CrossVersion.for3Use2_13 val scalaTest = "org.scalatest" %% "scalatest" % "3.2.11" % Test + val scala3Exclusions = Seq( + "com.typesafe.scala-logging" % "scala-logging_2.13", + "org.scala-lang.modules" % "scala-collection-compat_2.13" + ) + val core = Akka.base ++ Cats.all ++ Seq( kafkaClients, scalaLogging,