Skip to content

Instantly share code, notes, and snippets.

@danielsamuels
Created May 18, 2016 15:09
Show Gist options
  • Save danielsamuels/f15fdf7a5c17cd7d91a66b920323b765 to your computer and use it in GitHub Desktop.
Save danielsamuels/f15fdf7a5c17cd7d91a66b920323b765 to your computer and use it in GitHub Desktop.
pre-push hook
#!/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