Last active
December 16, 2021 08:42
-
-
Save jayu/4349fa040bff68c750816dd8e24156cd to your computer and use it in GitHub Desktop.
Git hook to detect console.log and todo added to codebase before commit
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
CONSOLE_LOGS="$(git diff HEAD | grep -e '^\+.*console.log' -ie '^\+.*todo')" | |
if [ ${#CONSOLE_LOGS} -ge 1 ] ; then | |
printf "😮 console.logs or todos found in commit diff!\n\n" | |
printf "$CONSOLE_LOGS\n\n" | |
echo '🛑 terminating' | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment