You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env bash
  2. git stash --keep-index -q
  3. source ~/.virtualenvs/oscar/bin/activate
  4. ./runtests.py
  5. TEST_RESULT=$?
  6. jshint oscar/static/oscar/js/oscar
  7. JS_RESULT=$?
  8. FILES_PATTERN='\.(py)(\..+)?$'
  9. FORBIDDEN='assert False'
  10. GREP_RESULT=1
  11. FILES=`git diff --cached --name-only | grep -E $FILES_PATTERN`
  12. if [ $? -eq 0 ]; then
  13. echo $FILES | xargs grep --color --with-filename -n "$FORBIDDEN"
  14. GREP_RESULT=$?
  15. fi
  16. git stash pop -q
  17. [ $TEST_RESULT -ne 0 ] && echo "Tests failed" && exit 1
  18. [ $JS_RESULT -ne 0 ] && echo "JShint failed" && exit 1
  19. [ $GREP_RESULT -eq 0 ] && echo "Found 'assert False'" && exit 1
  20. exit 0