Created
May 18, 2016 15:09
-
-
Save danielsamuels/f15fdf7a5c17cd7d91a66b920323b765 to your computer and use it in GitHub Desktop.
pre-push hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
. ~/.bash_profile | |
. .venv/bin/activate | |
pip install -q --disable-pip-version-check pylint pylint-django pylint-mccabe isort | |
IN_TEST=false | |
IN_OVERRIDE=false | |
FAILED=false | |
while read line; do | |
if [ "$line" == "test:" ]; then | |
IN_TEST=true | |
continue | |
fi | |
if [ $IN_TEST == true -a "$line" == "override:" ]; then | |
IN_OVERRIDE=true | |
continue | |
fi | |
if [ $IN_TEST != true -o $IN_OVERRIDE != true ]; then | |
continue | |
fi | |
if [ ${#line} -eq 0 ]; then | |
break | |
fi | |
echo ">>> ${line:2}" | |
eval ${line:2} | |
if [ $? -ne 0 ]; then | |
echo "<<< Check failed." | |
FAILED=true | |
else | |
echo "<<< Check passed." | |
fi | |
echo | |
done < circle.yml | |
if [ $FAILED == true ]; then | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment