Skip to content

Commit

Permalink
feat: add Scalafmt also to the template (project generator)
Browse files Browse the repository at this point in the history
  • Loading branch information
JavierCane committed Jun 20, 2024
1 parent ff43428 commit cfd7f6c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ jobs:
distribution: 'zulu'
java-version: '21'
cache: 'sbt'
- name: 👌 Run "pre-push" tasks (compile and style-check)
run: sbt prep
- name: ✅ Generate a project and run its test
run: sbt g8Test
11 changes: 11 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version = 3.3.0
runner.dialect = scala213
style = default
maxColumn = 120
continuationIndent.callSite = 2
align.preset = more
runner.optimizer.forceConfigStyleMinArgCount = 1
rewrite.rules = [SortImports]
importSelectors = singleLine
project.excludeFilters = ["target/"]
project.git = true # Only format files tracked by git
17 changes: 17 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,20 @@ lazy val root = (project in file("."))
url("https://repo.typesafe.com/typesafe/ivy-releases/")
)(Resolver.ivyStylePatterns)
)

/** ********* COMMANDS ALIASES ******************/
addCommandAlias("t", "test")
addCommandAlias("to", "testOnly")
addCommandAlias("tq", "testQuick")
addCommandAlias("tsf", "testShowFailed")

addCommandAlias("c", "compile")
addCommandAlias("tc", "Test / compile")

addCommandAlias("f", "scalafmt") // Format production files according to ScalaFmt
addCommandAlias("fc", "scalafmtCheck") // Check if production files are formatted according to ScalaFmt
addCommandAlias("tf", "Test / scalafmt") // Format test files according to ScalaFmt
addCommandAlias("tfc", "Test / scalafmtCheck") // Check if test files are formatted according to ScalaFmt

// All the needed tasks before pushing to the repository (compile, compile test, format check in prod and test)
addCommandAlias("prep", ";c;tc;fc;tfc")
1 change: 1 addition & 0 deletions project/sbt-scalafmt.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")

0 comments on commit cfd7f6c

Please sign in to comment.