Search code examples
continuous-integrationhistoryteamcitycode-metrics

Compiling historical information (esp. SLOCs) about a project


I am looking for a tool that will help me to compile a history of certain code metrics for a given project.

The project is stored inside a mercurial repository and has about a hundred revisions. I am looking for something that:

  • checks out each revision
  • computes the metrics and stores them somewhere with an identifier of the revision
  • does the same with the next revisions

For a start, counting SLOCs would be sufficient, but it would also be nice to analyze # of Tests,TestCoverage etc.

I know such things are usually handled by a CI Server, however I am solo on this project and thus haven't bothered to set up a CI Server (I'd like to use TeamCity but I really didn't see the benefit of doing so in the beginnig). If I'd set up my CI Server now, could it handle that?


Solution

  • According to jitter's suggestion I have written a small bash script running inside cygwin using sloccount for counting the source lines. The output was simply dumped to a textfile:

     #!/bin/bash
    COUNT=0 #startrev
    STOPATREV = 98
    until [ $COUNT -gt $STOPATREV ]; do
            hg update -C -r $COUNT >> sloc.log # update and log
            echo "" >> sloc.log # echo a newline
            rm -r lib # dont count lib folder
            sloccount /thisIsTheSourcePath | print_sum
            let COUNT=COUNT+1
    done