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.
This commit is contained in:
2021-11-06 13:34:33 -04:00
parent 0639b16c86
commit d07d37d08e
4 changed files with 16 additions and 10 deletions

6
format
View File

@ -5,10 +5,14 @@ if ! which black &>/dev/null; then
exit 1
fi
if [[ $1 == "check" ]]; then
check="--check"
fi
pushd $( git rev-parse --show-toplevel ) &>/dev/null
echo "Formatting..."
black --safe --exclude api-daemon/migrations .
black --safe ${check} --exclude api-daemon/migrations .
ret=$?
if [[ $ret -eq 0 ]]; then
echo "Successfully formatted project!"