Skip to content

Commit f91edca

Browse files
committed
implement suggestions from review
1 parent f9ea866 commit f91edca

File tree

3 files changed

+57
-49
lines changed

3 files changed

+57
-49
lines changed

build.sbt

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
addCommandAlias("check", "; scalafmtSbtCheck; scalafmtCheckAll; compile:scalafix --check ; test:scalafix --check")
2-
addCommandAlias("fix", "; scalafmtSbt; scalafmtAll; compile:scalafix ; test:scalafix")
3-
41
ThisBuild / organization := "com.avast"
52
ThisBuild / homepage := Some(url("https://github.com/avast/scala-server-toolkit"))
63
ThisBuild / description := "Functional programming toolkit for building server applications in Scala."
@@ -11,47 +8,10 @@ ThisBuild / scalaVersion := "2.13.0"
118

129
ThisBuild / turbo := true
1310

14-
lazy val commonSettings = Seq(
11+
lazy val commonSettings = BuildHelper.settingsCommon ++ Seq(
1512
libraryDependencies ++= Seq(
16-
compilerPlugin(Dependencies.kindProjector),
17-
compilerPlugin(Dependencies.betterMonadicFor),
18-
compilerPlugin(Dependencies.silencer),
19-
compilerPlugin(scalafixSemanticdb), // for scalafix
20-
Dependencies.silencerLib,
2113
Dependencies.catsEffect,
2214
Dependencies.Test.scalaTest % Test
23-
),
24-
Compile / compile / wartremoverErrors ++= Warts.all filterNot Set(
25-
Wart.Nothing, // keep, false positives all around
26-
Wart.Overloading,
27-
Wart.Any, // keep, false positives all around
28-
Wart.Equals, // keep, easier that way
29-
Wart.ToString, // keep, easier that way
30-
Wart.Product, // keep, false positives all around
31-
Wart.Serializable // keep, false positives all around
32-
),
33-
ThisBuild / scalafixDependencies ++= Seq(
34-
Dependencies.scalazzi // https://github.com/scalaz/scalazzi
35-
),
36-
scalacOptions ++= Seq(
37-
"-Yrangepos", // for scalafix. required by SemanticDB compiler plugin
38-
"-Ywarn-unused", // for scalafix. not present in sbt-tpolecat for 2.13
39-
"-P:silencer:checkUnused"
40-
),
41-
scalacOptions --= {
42-
if (!sys.env.contains("TRAVIS"))
43-
Seq(
44-
"-Xfatal-warnings" // for scala-fix https://scalacenter.github.io/scalafix/docs/rules/RemoveUnused.html
45-
)
46-
else
47-
Seq()
48-
},
49-
Test / publishArtifact := false,
50-
Test / test / wartremoverErrors := (Compile / compile / wartremoverErrors).value filterNot Set(
51-
Wart.MutableDataStructures,
52-
Wart.OptionPartial,
53-
Wart.AsInstanceOf,
54-
Wart.EitherProjectionPartial
5515
)
5616
)
5717

@@ -108,3 +68,6 @@ lazy val pureconfig = project
10868
name := "scala-server-toolkit-pureconfig",
10969
libraryDependencies += Dependencies.pureConfig
11070
)
71+
72+
addCommandAlias("check", "; scalafmtSbtCheck; scalafmtCheckAll; compile:scalafix --check ; test:scalafix --check")
73+
addCommandAlias("fix", "; scalafmtSbt; scalafmtAll; compile:scalafix ; test:scalafix")

project/BuildHelper.scala

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import sbt.Keys._
2+
import sbt._
3+
import scalafix.sbt.ScalafixPlugin.autoImport._
4+
import wartremover.WartRemover.autoImport._
5+
6+
object BuildHelper {
7+
lazy val settingsCommon = Seq(
8+
libraryDependencies ++= Seq(
9+
compilerPlugin(Dependencies.kindProjector),
10+
compilerPlugin(Dependencies.silencer),
11+
compilerPlugin(scalafixSemanticdb), // for scalafix
12+
Dependencies.silencerLib
13+
),
14+
Compile / compile / wartremoverErrors ++= Warts.all filterNot Set(
15+
Wart.Nothing, // keep, false positives all around
16+
Wart.Overloading,
17+
Wart.Any, // keep, false positives all around
18+
Wart.Equals, // keep, easier that way
19+
Wart.ToString, // keep, easier that way
20+
Wart.Product, // keep, false positives all around
21+
Wart.Serializable // keep, false positives all around
22+
),
23+
ThisBuild / scalafixDependencies ++= Seq(
24+
Dependencies.scalazzi // https://github.com/scalaz/scalazzi
25+
),
26+
scalacOptions ++= Seq(
27+
"-Yrangepos", // for scalafix. required by SemanticDB compiler plugin
28+
"-Ywarn-unused", // for scalafix. not present in sbt-tpolecat for 2.13
29+
"-P:silencer:checkUnused"
30+
),
31+
scalacOptions --= {
32+
if (!sys.env.contains("TRAVIS"))
33+
Seq(
34+
"-Xfatal-warnings" // for scala-fix https://scalacenter.github.io/scalafix/docs/rules/RemoveUnused.html
35+
)
36+
else
37+
Seq()
38+
},
39+
Test / publishArtifact := false,
40+
Test / test / wartremoverErrors := (Compile / compile / wartremoverErrors).value filterNot Set(
41+
Wart.MutableDataStructures,
42+
Wart.OptionPartial,
43+
Wart.AsInstanceOf,
44+
Wart.EitherProjectionPartial
45+
)
46+
)
47+
}

project/Dependencies.scala

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,22 @@ object Dependencies {
77
val kindProjector = "0.10.3"
88
val pureConfig = "0.12.0"
99
val scalaTest = "3.0.8"
10-
val zio = "1.0.0-RC13"
11-
val zioInteropCats = "2.0.0.0-RC4"
12-
val silencer = "1.4.3"
1310
val scalazzi = "0.1.3"
14-
val betterMonadicFor = "0.3.1"
11+
val silencer = "1.4.3"
1512
val slf4jApi = "1.7.28"
13+
val zio = "1.0.0-RC13"
14+
val zioInteropCats = "2.0.0.0-RC4"
1615
}
1716

1817
val catsEffect = "org.typelevel" %% "cats-effect" % Versions.catsEffect
1918
val kindProjector = "org.typelevel" %% "kind-projector" % Versions.kindProjector
2019
val pureConfig = "com.github.pureconfig" %% "pureconfig" % Versions.pureConfig
20+
val scalazzi = "com.github.vovapolu" %% "scaluzzi" % Versions.scalazzi
21+
val silencer = "com.github.ghik" % "silencer-plugin" % Versions.silencer cross CrossVersion.full
22+
val silencerLib = "com.github.ghik" % "silencer-lib" % Versions.silencer cross CrossVersion.full
2123
val slf4jApi = "org.slf4j" % "slf4j-api" % Versions.slf4jApi
2224
val zio = "dev.zio" %% "zio" % Versions.zio
2325
val zioInteropCats = "dev.zio" %% "zio-interop-cats" % Versions.zioInteropCats
24-
val silencer = "com.github.ghik" % "silencer-plugin" % Versions.silencer cross CrossVersion.full
25-
val silencerLib = "com.github.ghik" % "silencer-lib" % Versions.silencer cross CrossVersion.full
26-
val scalazzi = "com.github.vovapolu" %% "scaluzzi" % Versions.scalazzi
27-
val betterMonadicFor = "com.olegpy" %% "better-monadic-for" % Versions.betterMonadicFor
2826

2927
object Test {
3028

0 commit comments

Comments
 (0)