Skip to content

Commit

Permalink
Merge pull request #110 from froth/non-unit-statement
Browse files Browse the repository at this point in the history
Add `sbt-tpolecat` to prevent common bug patterns
  • Loading branch information
TonioGela authored Apr 28, 2024
2 parents bbe2242 + c0fb346 commit 9eb09d3
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 3 deletions.
4 changes: 3 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ lazy val root = (project in file("."))
"org.typelevel" %% "cats-effect-std" % "3.5.4",
"org.typelevel" %% "cats-effect-testing-specs2" % "1.5.0" % Test,
"org.typelevel" %% "munit-cats-effect-3" % "1.0.7" % Test
)
),
// Add sbt plugins here, so that scala steward updates them in the g8 template
addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.1"),
)
4 changes: 4 additions & 0 deletions src/main/g8/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ sbt run
```shell
sbt test
```

## sbt-tpolecat

This template uses the `sbt-tpolecat` sbt plugin to set Scala compiler options to recommended defaults. If you want to change these defaults or find out about the different modes the plugin can operate in you can find out [here](https://github.com/typelevel/sbt-tpolecat/).
8 changes: 7 additions & 1 deletion src/main/g8/build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import org.typelevel.sbt.tpolecat.*

ThisBuild / organization := "com.example"
ThisBuild / scalaVersion := $if(scala3.truthy)$"3.4.0"$else$"2.13.13"$endif$

$if(!use-fatal-warnings.truthy)$// This disables fatal-warnings for local development. To enable it in CI set the `SBT_TPOLECAT_CI` environment variable in your pipeline.
// See https://github.com/typelevel/sbt-tpolecat/?tab=readme-ov-file#modes
ThisBuild / tpolecatDefaultOptionsMode := VerboseMode
$endif$

lazy val root = (project in file(".")).settings(
name := "$name;format="norm"$",
libraryDependencies ++= Seq(
Expand All @@ -15,6 +22,5 @@ lazy val root = (project in file(".")).settings(
compilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1")$endif$$if(testlib-use-cats-effect-testing-specs2.truthy)$,
"org.typelevel" %% "cats-effect-testing-specs2" % "1.5.0" % Test$else$$endif$$if(testlib-use-munit-cats-effect-3.truthy)$,
"org.typelevel" %% "munit-cats-effect-3" % "1.0.7" % Test$else$$endif$
)
)
1 change: 1 addition & 0 deletions src/main/g8/default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ package=com.example
scala3 = no
testlib-use-munit-cats-effect-3 = yes
testlib-use-cats-effect-testing-specs2 = no
use-fatal-warnings = no
1 change: 1 addition & 0 deletions src/main/g8/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.1")
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package $package$

import cats.effect.{IO, SyncIO}
import munit.CatsEffectSuite

class HelloWorldSuite extends CatsEffectSuite {
Expand Down

0 comments on commit 9eb09d3

Please sign in to comment.