Code Metrics

One thing I like about open source projects is that it’s usually fairly easy to find out some metrics about the code. Things like: test coverage, LOC and the test code to production code ratio. In particular test coverage is one of the first things I look at when evaluating a piece of software.

So in the interest of transparency, I thought I’d share some of the metrics we track for LightSpeed.

h3. Visual Studio 2008 Code Metrics

Visual Studio 2008 can now calculate code metrics. Here’s the project level results for the LightSpeed framework:

| *Project*|Framework|
| *Configuration*|Release|
| *Scope*|Project|
| *Assembly*|C:\mindscape\code\LightSpeed\Trunk\Bin\Release\Mindscape.LightSpeed.dll|
| *Maintainability Index*|86|
| *Cyclomatic Complexity*|2,116|
| *Depth of Inheritance*|5|
| *Class Coupling*|285|
| *Lines of Code*|3,391|

h3. Test Coverage

We run NCover as part of our build process. Here’s the output:

    (c) 2006 Grant Drake
Using .config file: C:\Documents and Settings\Administrator\Local Settings\Temp\tmp5B20.tmp
-- Options:
     Project Name: LightSpeed
     Acceptance%:  90%
     Sort:         Name
     Filter:       None
     Xml Report:   ..\Artifacts\CoverageSummary.xml
     Html Report:  N/A
     Report Type:  ModuleClassSummary(4)
     Merge To:     N/A
     Exclusions:   (Included in report footer section)
     - any -1 matching  (IsRegex=False)

97.1% coverage, 419 unvisited sequence points in 7 files.

h3. Test Code to Production Code Ratio

Running the VS code metrics across a our unit test projects gives a LOC of *2974*. This gives us:

*Test Code to Production Code Ratio: 2,974/3,391 = 0.87*

I think commercial software companies need to start being a bit more transparent about code quality metrics. What do you think?

Tagged as General, LightSpeed

One Response to “Code Metrics”

  • […] Mindscape we even published some metrics about an earlier version of LightSpeed. I completely agree with Andrew’s comment that it would be beneficial for commercial software […]

  • Leave a Reply


Join our mailer

You should join our newsletter! Sent monthly:

Back to Top