Last active
August 10, 2021 17:43
-
-
Save GuiMarthe/9666972c61d91100065ee1c17c0f02e8 to your computer and use it in GitHub Desktop.
A pre commit hook for finding python `brekpoint` or `set_trace` in *.py files.
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 | |
grep_output=$(grep --color=always -E '^.*(breakpoint|set_trace)\(\)' -H -n -R -I -o --include="*.py") | |
[ $grep_output ] \ | |
&& echo 'Found breakpoint or set_trace in your code.' \ | |
&& echo "$grep_output"\ | |
&& exit 1 \ | |
|| exit 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment