views:

2550

answers:

8

I know there are quite a few line count tools around. Is there something simple that's not a part some other big package that you use ?

+4  A: 

Slick Edit Gadgets has a nice report breaking it down by lines of code, whitespace and comments. The plug-in is free and relatively small.

Ryan Lanciaux
I've used that too. It has a pie chart showing what proportion of each type of line is used in the code.
harriyott
+1  A: 

Sorry if it's not a direct answer but these days I much prefer to use code metric tools or profilers rather than lines of code. Ants profiler and NDepend are two that immediately come to mind.

It's just that these tools allow you to get a real grasp on the size/complexity of your software, lines of code is a very primitive metric.

Ash
I realize it is a primitive metric. I just wanted to know a ball park figure without drawing any major conclusions from it.
Tomas Pajonk
+1  A: 

You could use find and wc from this relatively small package, http://unxutils.sourceforge.net/

Like

find . -name *.cs -exec wc -l {} \;

Or, if you have a linux machine handy you can mount the drive and do it like that, and it'll give you a ballpark figure. You can complexify to remove comments, etc. But given that you just want a ballpark figure, shouldn't be necessary.

Vinko Vrsalovic
I think you mean `find . -name *.cs -exec wc -l {} \;`. What you posted will count files, not lines!
dbr
Yes, I meant that
Vinko Vrsalovic
A: 

not sure if this works in VS08 ... code project

the empirical programmer
A: 

I have also used this simple C# made tool.

http://richnewman.wordpress.com/2007/07/09/c-visual-basic-and-c-net-line-count-utility-version-2/

Tomas Pajonk
+1  A: 

I use this Python script:

import os, sys
total_count = 0
for root, dirs, filenames in os.walk(sys.argv[1]):
  dirs[:] = [ # prune search path
    dir for dir in dirs
    if dir.lower() not in ('.svn', 'excludefrombuild')]
  for filename in filenames:
    if os.path.splitext(filename)[1].lower() in ('.cpp', '.h'):
      fullname = os.path.join(root, filename)
      count = 0
      for line in open(fullname): count += 1
      total_count += count
      print count, fullname
print total_count
Constantin
A: 

Exact Magic's StodioTools package (free) shows Executable LoC among other metrics. This is a plug-in to VisualStudio 2008.

kotelni
+1  A: 

If you have Visual Studio 2008 Team Developer or Team Suite edition, you can get them directly in Visual Studio using Code Metrics.

Chris Melinn