Created
May 25, 2012 05:46
-
-
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
This file contains hidden or 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
| 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" | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Inspired by: https://github.com/pengwynn/dotfiles/blob/master/zsh/prompt.zsh#L149