Tool to count number of lines of code and metrics

  • Thread starter Thread starter Duggi
  • Start date Start date
D

Duggi

Hi

Does anyone know a good tool to count the number of lines of code in
my C# project. I need metrics like number of lines of code and
comments... etc...

Any recommendations... please welcome...
 
 From the command-line, the "wc.exe" utility.  Looking at Google, it  
appears there are lots of free implementations out there, and of course  
you could just write your own if you wanted (trivial, using StreamReader  
and a loop with a counter).

Of course, in the IDE you can just scroll to the end of the file and see  
what line number you're on.

As far as counting comments, that's somewhat harder and depends on your  
definition of a comment:

     // Is this one comment, or
     // is it two?

     /*  How about this one?  Is it
      *  just a single comment, or
      */ is it two?

Do you want to catch this kind of comment:

     if (false /* enable for debugging */)
     {
     }

Etc.

I'm not aware of any specific utility that does that, but you could  
probably whip one together using the Regex class.  Or perhaps just finda  
command-line regex-based utility (e.g. "grep").

Pete

Hi Peter

Thanks for the reply. I was looking for a third party utility rather
than developing my own. Any recomendations?

-Cnu
 
Hi

Does anyone know a good tool to count the number of lines of code in
my C# project. I need metrics like number of lines of code and
comments... etc...

Any recommendations... please welcome...

Hi,

I do not know of any such tool.

I have one question though, what kind of info (and how to use it) you
are planning in getting with that?
IMHO the number of lines is irrelevant and has nothing to do with
either the quality of the code nor the time involved writing it.
 
Back
Top