Created
May 20, 2022 13:20
-
-
Save edumucelli/8d25806d845e8d42888f056fad119033 to your computer and use it in GitHub Desktop.
Count TODO on your Git repositories
This file contains 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
#!/bin/bash | |
declare -a Repos=( | |
"https://github.com/canonical/go-dqlite.git" "https://github.com/canonical/ubuntu-image" | |
) | |
# That is not a fault-proof TODO counting, just something that give a good enough counting. | |
# There might be multiple edge cases not considered here. Leave a comment for improvements. | |
for val in ${Repos[@]}; do | |
git clone $val counting > /dev/null 2>&1 | |
AllTodos=`(cd counting && git grep -E "TODO|TODO:|TODO\(" | wc -l)` | |
ContextTodos=`(cd counting && git grep -E "context.TODO" | wc -l)` | |
# On Go repositories, there is sometimes context.TODO that we need to discard. | |
paste <(echo $val) <(echo $((AllTodos-ContextTodos)) ) | |
rm -rf counting | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment