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.