ccm (updated: October 30, 2009)
ccm is a tool that analyzes c/c++ and c# code and reports back on Cyclomatic Complexity, a metric introduced by Thomas McCabe back in the mid 70's.
This metric states the number of independent linear paths through a unit of code and is useful to determine how complex the unit of code is (for this particular tool, a unit is a function or a method).
Complex code is often hard to maintain and extend, so keeping an eye on cyclomatic complexity can pay off.
Highlights
- Analyzes both c, c++ and c# code
- Works on both managed and unmanaged code
- Command line version can output into xml, allowing easy integration with your build pipelines and Continuous Integration software
- Visual Studio 2005/2008 integration
- Command line version runs under mono on both Linux and Mac OS X
Visual Studio Integration
ccm integrates with Vistual Studio 2008 and 2010 (tested with Beta 2). A new tool window, Cyclomatic Complexity, can be opened from the Tools menu.
Command line Usage
ccm ships with a command line tool that accepts one argument; the path to a configuration file structured like below.
<ccm>
<analyze>
<folder>..\source1</folder>
<folder>..\source2</folder>
</analyze>
<exclude>
<file>file1.cpp</file>
<file>file2.cpp</file>
<folder>Folder1</folder>
<function>Foo::Bat</function>
</exclude>
<recursive>yes</recursive>
<outputXML>no</outputXML>
<numMetrics>10</numMetrics>
</ccm>
The path in the analyze element is relative to the location of the configuration file (passed as the only argument to ccm.exe).
Download
Runs on Windows XP and later, as long as the .NET Framework 2.0 is installed.Run this installer in order to install ccm.
Disclaimer
ccm, AND ANY AND ALL ACCOMPANYING SOFTWARE, FILES, DATA AND MATERIALS, ARE DISTRIBUTED AND PROVIDED "AS IS" AND WITH NO WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED.