I slapped together an awk script a couple of weeks ago to extract some
simple source metrics from the cvs log.  I noticed that the log entry for
each revision is accompanied by the number of lines added and deleted.
However, these counts don't appear to be useful when files are added or
removed.  The best my tool can do is identify add and remove events so the
user will use some other method to get the necessary information.

For what its worth, I think of these more as "source metrics" than "code
metrics".

Here's how you run my tool on a UNIX system:
     cvs -q log -N -d"date-range" | log-summary.awk

This tool reports
     number of lines added to text files
     number of lines deleted from text files
     number of programmers doing commits (and their names)
     number of binary files in repository [not limited to "date-range"]
     number of binary files modified (and their names)
     number of binary files added (and their names)
     number of binary files removed (and their names)
     number of text files modified (and their names)
     number of text files added (and their names)
     number of text files removed (and their names)

By [my] definition, binary files are those with -kb keyword substitution;
text files are those without -kb.
The number of lines added and deleted from text files DO NOT include
contributions from "cvs add" and "cvs remove".
The number of binary files in the repository is the only item reported that
is not limited to the "date-range".

We don't typically have subdirectories within our cvs modules, so this tool
is not adequately tested for that circumstance.
I'm pretty sure I don't handle files that go into the Attic and later come
out.

I would love to hear of any other deficiencies that y'all find in this
tool.  Improvements and bug fixes would be grand!

Joao C. Ferreira wrote:
>I'd like to know if there's a way of using CVS to collect statistics about
>lines of code.
>Basically, I'd like to know how to obtain the count of inserted lines,
>changed lines and deleted lines.

(See attached file: log-summary.awk)

log-summary.awk

Reply via email to