Calculate code metrics

Bjorn Reppen picture Bjorn Reppen · Sep 13, 2008 · Viewed 65.8k times · Source

Are there any tools available that will calculate code metrics (for example number of code lines, cyclomatic complexity, coupling, cohesion) for your project and over time produce a graph showing the trends?

Answer

aku picture aku · Sep 13, 2008

On my latest project I used SourceMonitor. It's a nice free tool for code metrics analysis.
Here is an excerpt from SourceMonitor official site:

  • Collects metrics in a fast, single pass through source files.
  • Measures metrics for source code written in C++, C, C#, VB.NET, Java, Delphi, Visual Basic (VB6) or HTML.
  • Includes method and function level metrics for C++, C, C#, VB.NET, Java, and Delphi.
  • Saves metrics in checkpoints for comparison during software development projects.
  • Displays and prints metrics in tables and charts.
  • Operates within a standard Windows GUI or inside your scripts using XML command files.
  • Exports metrics to XML or CSV (comma-separated-value) files for further processing with other tools.

For .NET beside NDepend which is simply the best tool, I can recommend vil.

Following tools can perform trend analysis: