add pre-push hook to check formatting

This commit is contained in:
Nadja Reitzenstein 2022-05-05 19:21:51 +02:00
parent 481649c8d2
commit 3078d5dab8
1 changed files with 12 additions and 0 deletions

12
tools/git-pre-push-hook Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
echo -e "Checking code formatting:\n=========================\n\n" 1>&2
cargo fmt --check
if [[ $? -ne 0 ]]
then
o=$?
echo -e "\n\nRun \`cargo fmt --all\` before pushing please." 1>&2
exit $o
fi