Skip to content

Instantly share code, notes, and snippets.

@ceicke
Created August 10, 2012 09:57
Show Gist options
  • Save ceicke/3313112 to your computer and use it in GitHub Desktop.
Save ceicke/3313112 to your computer and use it in GitHub Desktop.
Get some code line vs. test code metrics for each tag
#!/bin/bash
counter=0
for tag in `git for-each-ref --sort=taggerdate --format='%(refname:short)' refs/tags`
do
echo $tag
git checkout $tag
code_line_count=`grep -vR '^\s*$\|^\s*#.*$' ./app/**/* | wc -l`
test_line_count=`grep -vR '^\s*$\|^\s*#.*$' ./features/**/* | wc -l`
date=`git show --quiet refs/tags/$tag --format='%ad' | grep +`
Tagarray[$counter]="$tag;$date;$code_line_count;$test_line_count"
counter=$counter+1
done
printf "%s\n" "${Tagarray[@]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment