Skip to content

Instantly share code, notes, and snippets.

@nektro
Last active May 17, 2021 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nektro/5c6b99b992415a59df51e6bee238a829 to your computer and use it in GitHub Desktop.
Save nektro/5c6b99b992415a59df51e6bee238a829 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
todo='0'
echo "[" > todo_data.json
git log --reverse --oneline |
while IFS= read -r commit
do
hash=$(echo $commit | cut -d' ' -f1)
adds=$(git diff $hash~ $hash | grep '^\+' | grep 'TODO' | wc -l | xargs)
solv=$(git diff $hash~ $hash | grep '^\-' | grep 'TODO' | wc -l | xargs)
todo=$((todo + adds))
todo=$((todo - solv))
if [[ "$adds" != "0" ]] || [[ "$solv" != "0" ]]
then
date=$(git show -s --format=%ci $hash)
echo "[\"$date\", \"$hash\", $adds, $solv]," >> todo_data.json
echo "$hash: there are now $todo TODOs. added $adds, removed $solv"
fi
done
echo "]" >> todo_data.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment