Jan 18, 2007

Integrating CruiseControl.NET & SourceMonitor

CruiseControl.NET (ccnet) includes style sheets and integration instructions for Vil - a static analysis tool that provides a whole bunch of metrics for your code such as cycolmatic complexity, lines of code, number of methods, etc all of which are useful in monitoring the health of your application.

Unfortunately Vil hasn't been updated for quite some time and it doesn't work with .NET 2.0.  Kind of a bummer.

This is where SourceMonitor steps in.  SourceMonitor is a free code analysis tool that has some really nice features in the GUI and also features a command line interface with XML output making it a perfect candidate for integration with CruiseControl.NET.  Thankfully Robin Curry has done the hard work already and shown how to integrate these tools together as well as providing a bunch of screen shots of what the results look like in the dashboard.

I followed the bouncing ball today and had it working in about half an hour.  Statistics produced include call depth, cycolmatic complexity, number of lines vs number of statements, etc.  All really useful information (assuming you know what to do with it and you can interpret it correctly!)

SourceMonitor is quick and doesn't add much overhead to the build process however viewing the detailed results on the ccnet dashboard may take time if you have lots of files to analyse (like I do).  That said, this is something that is well worth adding to your cruise control configuration and I strongly recommend you have a look at it.

P.S. If you want VB.NET analysis you'll need to get your hands on the beta instead of the current release.


  1. who out there makes use of the SourceMonitor checkpoints? If yes where/how are the checkpoint names set?
    How is the "progress" in code quality(metrics-wise) shown in the ccnet dashboard?

  2. I wish SourceMonitor would accept a solution file in order to determine which source files to include. As it works now, it assumes that all files on the disk are for inclusion. If you have two solutions that use different subsets of the same source tree, there's no way to include only one solution's files in the analysis.

    Has anyone solved this? I might try writing an app that produces the SourceMonitor command XML from a .sln file...