Reputation: 5202
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 ?
Upvotes: 7
Views: 8925
Reputation: 5976
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.
Upvotes: 8
Reputation: 381
Project Line Counter is pretty cool, but you need an updated .reg file for VS 2008 and later. I have a .reg file for Visual Studio 2010 on my website: http://www.onemanmmo.com/index.php?cmd=newsitem&comment=news.1.41.0 There's some instructions in the discussion at CodeProject http://www.codeproject.com/KB/macros/linecount.aspx with info on getting it to run with Visual Studio 2008.
Upvotes: 0
Reputation: 438
Right click on Project in Solution explorer and select "Calculate Code Metrics".
Upvotes: 1
Reputation: 2076
If you have Visual Studio 2008 Team Developer or Team Suite edition, you can get them directly in Visual Studio using Code Metrics.
Upvotes: 2
Reputation: 1
Exact Magic's StodioTools package (free) shows Executable LoC among other metrics. This is a plug-in to VisualStudio 2008.
Upvotes: 0
Reputation: 28194
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
Upvotes: 2
Reputation: 5202
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/
Upvotes: 0
Reputation: 340396
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.
Upvotes: 1
Reputation: 62145
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.
Upvotes: 2