Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #!/bin/sh
  2. # This pre-commit hook prevents lint errors from getting committed
  3. # Requires jshint and grunt
  4. jshintout=$(/usr/local/bin/grunt jshint)
  5. exitcode=$?
  6.  
  7. files=$(git diff --cached --name-only --diff-filter=ACM | grep "\.js$")
  8. if [ "$files" = "" ]; then
  9. exit 0
  10. fi
  11.  
  12. if [ $exitcode -eq 0 ]; then
  13. echo "Jshint passed"
  14. else
  15. echo "Commit failed, please fix your hint errors"
  16. echo "$jshintout"
  17. exit 1
  18. fi
  19.  
  20. # Redirect output to stderr.
  21. exec 1>&2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement