Tugger the SLUGger!SLUG Mailing List Archives

RE: [SLUG] who wrote the most code?


Where's the structure, indentation, and documentation, aka comments in
the code ? Or do we open a a new OSSP for this project to get it cleaned
up. But then how would we measure who wrote the most code of the code
measuring code? :-) Ho hum.....


-----Original Message-----
From: Jamie Wilkinson [mailto:jaq@xxxxxxxxxxxxxx] 
Sent: Tuesday, 24 February 2004 2:07 PM
To: slug@xxxxxxxxxxx
Subject: [SLUG] who wrote the most code?

A few weeks ago, Benno asked me if I had a way to use cvs annotate to
work out percentages of code written, and after a short bit of hacking,
there was this:

a=; t=0; cvs ann 2>/dev/null | cut -c15-21 | sort | uniq -c | while read
i; do u=`echo $i | cut -f2 -d' '`; s=`echo $i | cut -f1 -d' '`;
t=$((${t-0} + $s)); echo $t $u $s ; done | sort -rn | while read i ; do
if [ "x$a" = "x" ]; then a=`echo $i | cut -f1 -d' '`; fi ; u=`echo $i |
cut -f2 -d' '`; s=`echo $i | cut -f3 -d' '`; s=$(($s * 100)); echo $u
$(($s / $a)); done

but I was looking at the subversion repo at work today, and wondered
the same thing... so with a bit of mangling here it is:

a=; t=0; find . -type f ! -regex '.*\.svn.*' -exec svn ann {} \;
2>/dev/null | awk '{print $2}' | sort | uniq -c | while read i; do
u=`echo $i | cut -f2 -d' '`; s=`echo $i | cut -f1 -d' '`; t=$((${t-0} +
$s)); echo $t $u $s ; done | sort -rn | while read i ; do if [ "x$a" =
"x" ]; then a=`echo $i | cut -f1 -d' '`; fi ; u=`echo $i | cut -f2 -d'
'`; s=`echo $i | cut -f3 -d' '`; s=$(($s * 100)); echo $u $(($s / $a));
done

Fun, eh? :-)

-- 
jaq@xxxxxxxxxxxxxx
http://spacepants.org/jaq.gpg