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:
-----------------------------------------
NCoverExplorer.Console 1.3.6.26
(c) 2006 Grant Drake
http://www.ncoverexplorer.org/
-----------------------------------------
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?
One Response to “Code Metrics”
Leave a Reply
![]()
BrainDump (1)
Community Code (1)
Events (6)
General (27)
Lab Samples (2)
LightSpeed (112)
MegaPack (3)
News (37)
Products (51)
Projects (4)
Screencast (6)
Silverlight (1)
Silverlight Elements (1)
SimpleDB Management Tools (8)
Visual Studio (4)
VS File Explorer (4)
WPF (28)
WPF Diagramming (11)
WPF Elements (15)
WPF Property Grid (20)
![]()
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007



Tagged as

Posted by Andrew Peters on 3 December 2007 



[...] 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 [...]