Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # This pre-commit hook prevents lint errors from getting committed
- # Requires jshint and grunt
- jshintout=$(/usr/local/bin/grunt jshint)
- exitcode=$?
- files=$(git diff --cached --name-only --diff-filter=ACM | grep "\.js$")
- if [ "$files" = "" ]; then
- exit 0
- fi
- if [ $exitcode -eq 0 ]; then
- echo "Jshint passed"
- else
- echo "Commit failed, please fix your hint errors"
- echo "$jshintout"
- exit 1
- fi
- # Redirect output to stderr.
- exec 1>&2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement