Counting lines

Benno benjl at cse.unsw.edu.au
Sun Jun 9 02:10:20 CEST 2002


Lulu of the Lotus-Eaters <mertz at gnosis.cx> wrote in message news:<mailman.1023557203.18547.python-list at python.org>...
> Since this thread has drifted into line counts, I think it worth sharing
> a resource that a fellow-developer shared with me:
> 
>     SLOCCount:
>     http://www.dwheeler.com/sloccount/
> 
> Take a look.  It's not written in Python (I don't think), but it seems
> to do a large superset of what pycount.py does.  SLOCCount counts the
> lines of code in a large number of different programming languages,
> using rather clever rules and heuristics both to identify what language
> a file actually is, and to discern which lines are code versus comments
> (including, e.g. Python docstrings).

Nice program. Although lines of count has to be about the most abused metric 
in existence IMHO. It should surely be the aim of any project to *minimise*
the number of lines of code. (Fewer lines genreally means fewer opporunities
for bugs, easier to find bugs, easier to maintain, and less chance of 
duplication.) In my own code I find refactoring (or even rewriting in some 
cases), can reduce the lines of code by a factor of 10.

Cheers,

Benno



More information about the Python-list mailing list