Created
May 26, 2017 09:57
-
-
Save imdadahad/defe2b3894f1993d564e883291ef62f0 to your computer and use it in GitHub Desktop.
Git hook to run pycodestyle when committing to repo
This file contains hidden or 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 | |
function display_result { | |
RESULT=$1 | |
EXIT_STATUS=$2 | |
TEST=$3 | |
if [ $RESULT -ne 0 ]; then | |
echo -e "\033[31m$TEST failed\033[0m" | |
exit $EXIT_STATUS | |
else | |
echo -e "\033[32m$TEST passed\033[0m" | |
fi | |
} | |
pycodestyle . | |
display_result $? 1 "Code style check |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment