From f2076c95720181037b6c8a688c836739b906d106 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 6 Dec 2019 12:54:13 -0500 Subject: [PATCH] Fixed git commit hook --- scripts/git-hooks/pre-commit | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/git-hooks/pre-commit b/scripts/git-hooks/pre-commit index e6074ef9f..7dfa5e8aa 100755 --- a/scripts/git-hooks/pre-commit +++ b/scripts/git-hooks/pre-commit @@ -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