Skip to content

Commit

Permalink
Add scalafmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mdedetrich committed Jan 25, 2024
1 parent 77714f6 commit 809fb46
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Scalafmt

permissions: {}

on:
pull_request:
branches: ['**']

jobs:
build:
name: Code is formatted
runs-on: ubuntu-latest
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Check project is formatted
uses: jrouly/scalafmt-native-action@v3
with:
arguments: '--list --mode diff-ref=origin/main'
26 changes: 26 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version = 3.7.17
runner.dialect = scala212
maxColumn = 120
project.git = true

# http://docs.scala-lang.org/style/scaladoc.html recommends the JavaDoc style.
# scala/scala is written that way too https://github.com/scala/scala/blob/v2.12.2/src/library/scala/Predef.scala
docstrings.style = Asterisk

# This also seems more idiomatic to include whitespace in import x.{ yyy }
spaces.inImportCurlyBraces = true

align.tokens."+" = [
{
code = "%"
owners = [
{ regex = "Term.ApplyInfix" }
]
},
{
code = "%%"
owners = [
{ regex = "Term.ApplyInfix" }
]
}
]

0 comments on commit 809fb46

Please sign in to comment.