Might want to consider the case where file name can be white space. Just adding a IFS='\n' before the for loop is probably enough.
# Check for flake8
I suggest using the flake8 script which gets installed in venv/bin, so that the user doesn't have to install a ilbrary globally if they don't want to.
I think we can assume git commit would be running inside virtual env, plus venv directory can be located elsewhere too
for FILE in $STAGED_FILES
Is there a reason why we need to invoke flake8 on each file separately? If you just run flake8 once from the root directory, it'll lint all of the source files at once.
if [[ "$?" == 0 ]]; then
echo -e "\t\033[32mPassed: $FILE\033[0m"
flake8 provides its own diagnostic messages for each lint error, so I don't think we need to add an extra "Passed" or "Failed" message.
echo -e "\nPython linting complete!\n"
if ! $PASS; then
echo -e "\033[41mCOMMIT FAILED:\033[0m Your commit contains files that should pass ESLint but do not. Please fix the ESLint errors and try again.\n"
Maybe we should change "ESLint" to "flake8"?
No due date set.
No dependencies set.
Deleting a branch is permanent. It CANNOT be undone. Continue?