Skip to content

Commit

Permalink
Fixed git commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Dec 6, 2019
1 parent d71e669 commit f2076c9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions scripts/git-hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,24 @@

exec 1>&2

EXIT=0
RED='\033[0;31m'
NOCOLOR='\033[0m'

echo "Validating PEP8 compliance..."
pycodestyle --ignore=W504,E501 netbox/
if [ $? != 0 ]; then
EXIT=1
fi

echo "Checking for missing migrations..."
python netbox/manage.py makemigrations --dry-run --check
if [ $? != 0 ]; then
EXIT=1
fi

if [ $EXIT != 0 ]; then
printf "${RED}COMMIT FAILED${NOCOLOR}\n"
fi

exit $EXIT

0 comments on commit f2076c9

Please sign in to comment.