Wednesday, November 18, 2009

SourceMonitor for .NET code quality metrics

A tip of the hat to Paul Rayner for recommending SourceMonitor for .NET code quality metrics. I gave this freeware tool a spin today on a C# project I'm working on for a large client, and was very happy. It's easy to use and within a few minutes I had it installed and ran the analysis on the whole project, gathering these metrics for the whole solution, and for each C# file within the solution:
  • number of statements
  • methods per class
  • calls per method
  • statements per method
  • average and maximum complexity
  • average and maximum block depth (number of levels of indentation/curly braces)
This is a great tool to quickly find potential problem spots within the solution, so you can identify the components that would likely benefit the most from some refactoring and additional testing.