views:

112

answers:

3

Is there a tool that calculates various LOC statistics? It would have to support popular languages like C++, C#, Python, PHP, JavaScript, ActionScript, etc and interpret code accordingly.

An example of the statistics I'm looking for:

  • 350 Physical lines of code -- including braces
  • 200 Logical lines of code -- actual code
  • 190 Comment lines
  • 68 Variables
  • 28 Methods/Functions
  • 5 Classes
  • 3 Namespaces
+1  A: 

Here's a great list:

http://www.locmetrics.com/alternatives.html

gmale
+2  A: 

You want to measure a wide range of langauges. In general it is hard to get a single tool to do that, because it has to know too much about all the langauges of interest.

Our Source Code Search Engine is a commercial tool for searching an organization's code base across multiple languages. It uses separate language-specific front ends to "parse" each of the langauges it supports so it can build an index to support fast search for that language taking advantage of the precise lexical syntax of each langauge. The search engine front ends cover all the langauges in your list off-the-shelf except ActionScript (and that might not be very far off).

A side effect of of the indexing step is the computation of SLOC, comment-count, whitespace-line-count, as well as cyclomatic and halstead measures for each file, produced as XML document. So you can scan a code base of 10,000 files and get relative metrics for each file. It does not count methods/functions, etc.

Ira Baxter
+1: Good answer, Ira, though you might have been more specific in stating that this is a tool created by your company. Not everyone will look at your profile to determine this.
John Saunders
I have followed SO policy, and noted specifically that it is *our* product. See the text in the answer; no need to look at my profile.
Ira Baxter
A: 

I found these apps capable of LOC statistics for Flash/Flex ActionScript projects.

Jenko