Skip to content

Commit

Permalink
Add version specific scalafix config
Browse files Browse the repository at this point in the history
  • Loading branch information
bcarter97 committed Apr 23, 2022
1 parent 307ff2b commit 40b1916
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
rules = [
RemoveUnused,
NoAutoTupling,
DisableSyntax,
LeakingImplicitClassVal,
NoValInForComprehension,
ProcedureSyntax
]

OrganizeImports {
Expand Down
19 changes: 19 additions & 0 deletions .scalafix3.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
rules = [
NoAutoTupling,
DisableSyntax,
LeakingImplicitClassVal,
NoValInForComprehension,
]

OrganizeImports {
coalesceToWildcardImportThreshold = 8
expandRelative = true
groupedImports = Merge
importSelectorsOrder = SymbolsFirst
removeUnused = false
groups = [
"java."
"*"
"scala."
]
}
17 changes: 11 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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")
Expand Down
5 changes: 5 additions & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 40b1916

Please sign in to comment.