Skip to content

Instantly share code, notes, and snippets.

@crlane
Created June 22, 2025 12:06
Show Gist options
  • Save crlane/eea2226cfeb9cd58571dd6072e1e5db7 to your computer and use it in GitHub Desktop.
Save crlane/eea2226cfeb9cd58571dd6072e1e5db7 to your computer and use it in GitHub Desktop.
Precommit Hook to Detect Python Debug Breakpoints
#!/usr/bin/env bash
REGEX="(i?pdb|__import__\((\'|\")i?pdb(\'|\")\)).set_trace\(\)"
if git-grep --cached -n -P "$REGEX"; then
echo "Your commit includes interactive debug statements. Please remove"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment