Skip to content

Instantly share code, notes, and snippets.

@dfm
Created May 25, 2012 05:46
Show Gist options
  • Save dfm/2786013 to your computer and use it in GitHub Desktop.
Save dfm/2786013 to your computer and use it in GitHub Desktop.
Count the number of occurrences of "FIXME", "TODO", etc. in the current git repository
function count_code_booboos() {
GIT_DIR=$(git rev-parse --git-dir 2> /dev/null) || return
NOTES_PATTERN="FIXME|TODO|MAGIC"
NOTES_RES=$(echo $(ack -hi --ignore-dir="venv" --ignore-dir="build" \
"\b$NOTES_PATTERN\b" "$(dirname $GIT_DIR)" 2>/dev/null))
for NM in "FIXME" "MAGIC" "TODO"
do
num=$(echo $(echo $NOTES_RES | ack -i "\b$NM\b" | wc -l))
if [ $num != 0 ]
then
printf "$NM: $num "
fi
done
printf "\n"
}
@dfm
Copy link
Author

dfm commented May 25, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment