Add pre-commit hook that enforces ormolu formatting
This commit is contained in:
parent
c5dca4b33a
commit
9866603dbe
17
pre-commit
Executable file
17
pre-commit
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
|
||||||
|
tmp=$(mktemp)
|
||||||
|
|
||||||
|
|
||||||
|
find src/ -type f | while read f; do
|
||||||
|
if ! ormolu --mode check "$f"; then
|
||||||
|
echo "$f is not properly formatted"
|
||||||
|
echo 1 > "$tmp"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
if test "X1" = "X$(cat "$tmp")"; then
|
||||||
|
exit 1
|
||||||
|
fi
|
|
@ -2,11 +2,11 @@
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
{-# LANGUAGE NoImplicitPrelude #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
import Protolude hiding (for)
|
|
||||||
import Pretty
|
|
||||||
import WS19
|
|
||||||
import Pipes
|
import Pipes
|
||||||
|
import Pretty
|
||||||
|
import Protolude hiding (for)
|
||||||
import System.IO
|
import System.IO
|
||||||
|
import WS19
|
||||||
|
|
||||||
mkPop = population 100 (I prios [])
|
mkPop = population 100 (I prios [])
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
{-# LANGUAGE NoImplicitPrelude #-}
|
||||||
|
|
||||||
|
|
||||||
module Pretty where
|
module Pretty where
|
||||||
|
|
||||||
|
|
||||||
import Protolude
|
import Protolude
|
||||||
|
|
||||||
|
|
||||||
class Pretty a where
|
class Pretty a where
|
||||||
pretty :: a -> Text
|
pretty :: a -> Text
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
|
import qualified GA
|
||||||
import Protolude
|
import Protolude
|
||||||
import qualified Seminar
|
import qualified Seminar
|
||||||
import qualified GA
|
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
|
|
Loading…
Reference in New Issue
Block a user