Browse Source

Check format of .js files in pre-commit hook.

pull/37/head
Joachim Bauch 11 years ago
parent
commit
a49d3af911
  1. 25
      src/hooks/pre-commit.hook

25
src/hooks/pre-commit.hook

@ -28,6 +28,31 @@ echo "========================================================================== @@ -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

Loading…
Cancel
Save