开发者

Compiling historical information (esp. SLOCs) about a project

开发者 https://www.devze.com 2022-12-12 06:05 出处:网络
I am looking for a tool that will help me to compile a history of certain code metrics for a given 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 ha开发者_C百科ndle that?


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 


You could write a e.g. shell script which

  1. checks out first version
  2. run sloccount on it (save output)
  3. check out next version
  4. repeat steps 2-4

Or look into ohloh which seems to have mercurial support by now.

Otherwise I don't know of any SCM statistics tool which supports mercurial. As mercurial is relatively young (since 2005) it might take some time until such "secondary use cases" are supported. (HINT: maybe provide a hgstat library yourself as there are for svn and csv)


If it were me writing software to do that kind of thing, I think I'd dump metrics results for the project into a single file, and revision control that. Then the "historical analysis" tool would have to pull out old versions of just that one file, rather than having to pull out every old copy of the entire repository and rerun all the tests every time.

0

精彩评论

暂无评论...
验证码 换一张
取 消