From 10ee63f9e06fb4e39288f00ecfc04511cc31a92f Mon Sep 17 00:00:00 2001 From: sourabhxyz Date: Thu, 5 Sep 2024 19:26:13 +0530 Subject: [PATCH] ci(#348): add fourmolu auto-commit to CI --- .github/workflows/haskell.yml | 16 ++++++++++++ fourmolu.yaml | 48 ++++++++++++++++++++++++++++++++--- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 5d87eced..58256f8f 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -118,6 +118,22 @@ jobs: ${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build- ${{ runner.os }}- + + - name: Install fourmolu + run: cabal install fourmolu --overwrite-policy=always + + - name: Lint Haskell + run: | + find . -name '*.hs' -exec sh -c 'for file do fourmolu -i "$file"; done' sh {} + + + - name: Auto-commit lint + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: fourmolu auto-commit + commit_user_name: GitHub Action + commit_user_email: action@github.com + branch: ${{ github.head_ref }} + - name: Install LIBSODIUM run: | git clone https://github.com/input-output-hk/libsodium diff --git a/fourmolu.yaml b/fourmolu.yaml index c7f07713..16e19972 100644 --- a/fourmolu.yaml +++ b/fourmolu.yaml @@ -1,7 +1,47 @@ +# Number of spaces per indentation step indentation: 2 -comma-style: leading + +# Max line length for automatic line breaking +column-limit: none + +# Styling of arrows in type signatures (choices: trailing, leading, or leading-args) +function-arrows: leading + +# How to place commas in multi-line lists, records, etc. (choices: leading or trailing) +comma-style: trailing + +# Styling of import/export lists (choices: leading, trailing, or diff-friendly) +import-export-style: diff-friendly + +# Whether to full-indent or half-indent 'where' bindings past the preceding body +indent-wheres: false + +# Whether to leave a space before an opening record brace record-brace-space: true -indent-wheres: true -respectful: true -haddock-style: multi-line + +# Number of spaces between top-level declarations newlines-between-decls: 1 + +# How to print Haddock comments (choices: single-line, multi-line, or multi-line-compact) +haddock-style: multi-line + +# How to print module docstring +haddock-style-module: null + +# Styling of let blocks (choices: auto, inline, newline, or mixed) +let-style: auto + +# How to align the 'in' keyword with respect to the 'let' keyword (choices: left-align, right-align, or no-space) +in-style: right-align + +# Whether to put parentheses around a single constraint (choices: auto, always, or never) +single-constraint-parens: never + +# Output Unicode syntax (choices: detect, always, or never) +unicode: always + +# Give the programmer more choice on where to insert blank lines +respectful: false + +# Fixity information for operators +fixities: []