Skip to content

Commit

Permalink
add ormolu formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
antonkesy committed Mar 4, 2024
1 parent 318214e commit 32a903b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: local
hooks:
- id: ormolu-formatter
name: ormolu-formatter
entry: bash -c "stack install ormolu && ormolu --mode inplace $(find . -name '*.hs')"
language: system
types: [haskell]
pass_filenames: false
always_run: true
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@ RUN curl -sSL https://get.haskellstack.org/ | sh
ENV PATH="/root/.local/bin:${PATH}"
RUN stack --resolver ghc-9.6.4 setup

RUN stack install omolu

WORKDIR /peter-lang

COPY . /peter-lang

RUN stack build
# cancel the build if there are formatting errors
RUN ormolu --mode check $(find . -name '*.hs')
# build project
RUN stack build
RUN stack test
# pre-commit
RUN git init . && pre-commit install-hooks
RUN pre-commit run --all-files
1 change: 1 addition & 0 deletions Setup.hs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import Distribution.Simple

main = defaultMain
5 changes: 3 additions & 2 deletions src/Lib.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Lib
( someFunc
) where
( someFunc,
)
where

someFunc :: IO ()
someFunc = putStrLn "someFunc"

0 comments on commit 32a903b

Please sign in to comment.