pvc/.hooks/pre-commit
Joshua M. Boniface 0cc3f2deab Revamp formatting and linting on commit
Remove the prepare script, and run the two stages manually. Better
handle Black reformatting by doing a check (for the errcode) then
reformat and abort commit to review.
2021-11-06 13:34:33 -04:00

23 lines
342 B
Bash
Executable File

#!/usr/bin/env bash
pushd $( git rev-parse --show-toplevel ) &>/dev/null
ex=0
./format check
if [[ $? -ne 0 ]]; then
./format
echo "Black formatting change detected; review and recommit"
ex=1
fi
./lint
if [[ $? -ne 0 ]]; then
echo "Linting error detected; correct and recommit"
ex=1
fi
echo
popd &>/dev/null
exit $ex