diff --git a/src/hooks/pre-commit.hook b/src/hooks/pre-commit.hook index 17098f1b..522ed4f5 100755 --- a/src/hooks/pre-commit.hook +++ b/src/hooks/pre-commit.hook @@ -28,6 +28,31 @@ echo "========================================================================== done +for file in `git diff-index --cached --name-only HEAD --diff-filter=ACMR| grep "\.js$"` ; do + case "$file" in + */libs/*) + echo "Not checking library ${file}" + ;; + *) + echo "Checking ${file}" + nf=`git checkout-index --temp ${file} | cut -f 1` + jshint --config .jshint "${nf}" + r=$? + rm "${nf}" + if [ $r != 0 ] ; then + echo "=================================================================================================" + echo " Code format error in: $file " + echo " " + echo " Please fix before committing. Don't forget to run git add before trying to commit again. " + echo " " + echo "=================================================================================================" + exit 1 + fi + ;; + esac +done + + check_styles=0 for file in `git diff-index --cached --name-only HEAD --diff-filter=ACMR| grep "\.scss$"` ; do check_styles=1