Skip to content

Instantly share code, notes, and snippets.

@imdadahad
Created May 26, 2017 09:57
Show Gist options
  • Save imdadahad/defe2b3894f1993d564e883291ef62f0 to your computer and use it in GitHub Desktop.
Save imdadahad/defe2b3894f1993d564e883291ef62f0 to your computer and use it in GitHub Desktop.
Git hook to run pycodestyle when committing to repo
#!/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