Skip to content

Instantly share code, notes, and snippets.

@GuiMarthe
Last active August 10, 2021 17:43
Show Gist options
  • Save GuiMarthe/9666972c61d91100065ee1c17c0f02e8 to your computer and use it in GitHub Desktop.
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.
#!/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