Skip to content

Instantly share code, notes, and snippets.

@brouberol
Created October 28, 2014 18:18
Show Gist options
  • Save brouberol/ad03a94eb0422b50e888 to your computer and use it in GitHub Desktop.
Save brouberol/ad03a94eb0422b50e888 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Check for uncommented debug patterns (pdb, ipdb, rdb) in python files.
# If such patterns are matched, prevent the commit
PATTERN="^[^#]*(i?pdb|rdb)"
debug_statements=`ack $PATTERN --py`
if [ -z "$debug_statements" ];then
exit 0
else
echo "Commit aborted. Uncommented debug statements found:"
echo "$debug_statements"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment