I advise people to set up a commit hook to run ormolu for you; you can do so by creating an executable file named .git/hooks/pre-commit with the following contents:
#!/usr/bin/env bash
set -e
# command adapted from https://github.com/JLLeitschuh/ktlint-gradle task addKtlintFormatGitPreCommitHook
filesToFormat="$(git --no-pager diff --name-status --no-color --cached | \
awk '($1 == "M" || $1 == "A") && $2 ~ /\.hs/ { print $2} $1 ~ /R/ && $3 ~ /\.hs/ { print $3 } ')"
echo "files to format $filesToFormat"
for sourceFilePath in $filesToFormat
do
ormolu --mode inplace "$(pwd)/$sourceFilePath"
git add $sourceFilePath
done;
I'll add that to the readme and to the repo on a separate PR used to update the readmes.
This PR brings in a lot of changes that were produced by
ormolu
; the important changes are w.r.t. hooking up ormolu to our CI:Closes #105
I advise people to set up a commit hook to run ormolu for you; you can do so by creating an executable file named
.git/hooks/pre-commit
with the following contents:I'll add that to the readme and to the repo on a separate PR used to update the readmes.