forked from schmittlauch/Hash2Pub
Linting integration
This commit brings in an HLint configuration file and several recommended modifications such as: * End-of-line extra spaces removal; * Import lines ordering; * Redundant $ removal; * Generalisation of ++ and map to <> and fmap; * Preferring `pure` over `return`; * Removing extraenous extensions. And finally, a `stylish-haskell` helper script that detects if code files are dirty. Can be useful for CI, although manually calling it can be nice if you would rather first implement then beautify.
This commit is contained in:
parent
d049b65f1e
commit
41e999ed99
11 changed files with 281 additions and 248 deletions
32
stylish.sh
Executable file
32
stylish.sh
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
function ls-source-files {
|
||||
git ls-files "app/*.hs" "src/*.hs" "test/*.hs"
|
||||
}
|
||||
|
||||
function check-git-status {
|
||||
[ "$(git status -s '*.hs' | wc -l)" == "0" ]
|
||||
}
|
||||
|
||||
function stylish {
|
||||
stylish-haskell -i $(ls-source-files)
|
||||
}
|
||||
|
||||
if check-git-status
|
||||
then
|
||||
echo "Running stylish-haskell..."
|
||||
stylish
|
||||
echo "Done."
|
||||
if check-git-status
|
||||
then
|
||||
echo "OK, impeccable style."
|
||||
else
|
||||
echo "KO! Lack of style on those files:"
|
||||
git status -sb
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "git status not clean, aborting"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue