tags:

views:

86

answers:

8

i wrote an application in VB.NET and since i charge by the line, i would like to calculate how many lines i wrote. i have about 100 different vb files with my code. how do i count all the lines?

+2  A: 

You could do a regex search for a line-break char that isn't followed by another linebreak (excluding blank lines)

Alternatively there's this app http://cloc.sourceforge.net/ (I haven't used it, I just found it)

Glenn Slaven
A: 

Line Counter on sourceforge is a VB.NET app that counts the lines for you in your app. I was going to say you could write your own VB.NET app to do this, but luckily it has already been done. It's sweet how the internet works that way.

Also, charging by the line? Newline must be your friend! LOL.

Kaleb Brasee
A: 

on a *nixy platform:

 find . -name *.vb | xargs wc -l

PS: This should probably be on superuser.

Autopulated
VB.NET usually doesn't imply a *nix-y platform :-)
Joey
No, but Autopulated is probably wondering (as I am) why it's such a problem to count the number of lines in a bunch of files. I imagine the Powershell solution is similarly concise.
pavium
+1  A: 

If you're using VS2005 or earlier then there's a line counter add-in at WndTabs.com

Richard Ev
A: 

I really hope you're joking about charging by the line, but if not, there are a number of prepackaged free utilities and scripts that will do these sort of quick-and-dirty metrics for you, like the Line Count Utility.

P.S. Please consider a different way of charging your customers!

John Feminella
A: 

I think this is a problematic question.

Just to make a point, how many lines of code is this:

function foofoo()
{
    /// just a comment
    int x=1;

    return;
}

is this 3, 5, 7?

Am
+2  A: 

On the command line:

(for /r %x in (*.vb) do @type "%x") | find /v /c ""
Joey
+2  A: 

This can be done in Powershell:

  1. Example 1
  2. Example 2

I also recommend the excellent NDepends suite as well. For one I think it will clearly illustrate why lines of code is a very difficult thing to measure, and not necessarily a good measure of quality, or amount of work in a codebase.

GrayWizardx