Provide Cabal-hooks in test environment
[cabal.git] / .githooks / pre-push
blob599d13015f94c1dd0eea82f2e00dc7c3ae747b5b
1 #!/usr/bin/env bash
3 set -euxo pipefail
5 if [[ $(uname -s) != "Linux" ]]
6 then
7 PROCS=$(sysctl -n hw.logicalcpu)
8 else
9 PROCS=$(nproc)
12 if which fourmolu > /dev/null ; then
13 find Cabal Cabal-syntax cabal-install -name '*.hs' -print0 \
14 ! -path Cabal-syntax/src/Distribution/Fields/Lexer.hs \
15 ! -path Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs \
16 ! -path Cabal-syntax/src/Distribution/SPDX/LicenseId.hs \
17 ! -path Cabal/src/Distribution/Simple/Build/Macros/Z.hs \
18 ! -path Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs \
19 | xargs -P "${PROCS}" -I {} fourmolu -q --mode check {}
20 else
21 echo "Fourmolu not found, aborting."
22 exit 1