diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a6c9bae94..f28e171f9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,3 +22,13 @@ jobs: - name: Run tests run: | nix-shell --command "sbt -DSnippetsContainerTest.mongo=true cachedCiTest" + formatting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v24 + with: + nix_path: nixpkgs=channel:nixos-22.11 + - name: Check formatting + run: | + nix-shell --command "sbt scalafmtCheckAll" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 16447a9a8..51b88c4fa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -60,7 +60,7 @@ open `http://localhost:9000` ## Scalafmt -Make sure to run `bin/scalafmt` to format your code. +Make sure to run `sbt scalafmtAll` to format your code. You can install a pre-commit hook with `bin/hooks.sh` diff --git a/bin/scalafmt b/bin/scalafmt deleted file mode 100755 index db464d36a..000000000 --- a/bin/scalafmt +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -# set -x - -HERE="`dirname $0`" - -if [ ! -f $HERE/.coursier ]; then - curl -L -o $HERE/.coursier https://git.io/vgvpD - chmod +x $HERE/.coursier -fi - -if [ ! -f $HERE/.scalafmt ]; then - $HERE/.coursier bootstrap com.geirsson:scalafmt-cli_2.12:1.5.1 --main org.scalafmt.cli.Cli -o $HERE/.scalafmt - chmod +x $HERE/.scalafmt -fi - -$HERE/.scalafmt "$@" diff --git a/project/plugins.sbt b/project/plugins.sbt index 7c7941c74..60638e017 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,5 @@ +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.4") + addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.1.5") addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16") addSbtPlugin("io.spray" % "sbt-revolver" % "0.10.0")