Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sbt-tpolecat to prevent common bug patterns #110

Merged
merged 5 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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