-
-
Save aehlke/ea47c67a2cf1d01f711d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -n $VIRTUAL_ENV ]; then | |
PATH=$VIRTUAL_ENV/bin:$PATH | |
fi | |
REPO=$(pwd) | |
EXIT_CODE=0 | |
for FILE in `git diff-index --name-only --cached HEAD -- | egrep .js$`; do | |
jshint ${REPO}/${FILE} | |
EXIT_CODE=$((${EXIT_CODE} + $?)) | |
done | |
if [[ ${EXIT_CODE} -ne 0 ]]; then | |
echo "Aborted due to JSHint errors." | |
exit $EXIT_CODE | |
fi | |
for FILE in `git diff-index --name-only --cached HEAD -- | egrep .py$`; do | |
flake8 ${REPO}/${FILE} --max-complexity=10 | |
EXIT_CODE=$((${EXIT_CODE} + $?)) | |
done | |
if [[ ${EXIT_CODE} -ne 0 ]]; then | |
echo "Aborted due to flake8 errors." | |
exit $EXIT_CODE | |
fi | |
exit $EXIT_CODE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sudo npm install -g jshint; sudo pip install flake8
From @brianpeiris: