SourceMonitor and CruiseControl - The Top 15
As a follow up to yesterdays post on SourceMonitor and CruiseControl.NET integration, Eden Ridgway has done some really nice work and posted a few styles sheets to help you create a SourceMonitor Top 15 Summary of worst methods so you can target your refactoring efforts.
Thing good thing is you don't have to use MSBuild as Eden indicates and the steps to get it working are really easy.
Also, if you have nesting that goes to 9+ levels, then the summary won't show it. To get this showing you need to change the data-type to "text" in the Nesting Metrics section as shown here:
Update: Eden has since fixed the stylesheet errors and made it easier to customise the number of items to show. Thanks mate!
Thing good thing is you don't have to use MSBuild as Eden indicates and the steps to get it working are really easy.
- First, get SourceMonitor and CCNet working together.
- Next, download the style sheets from Edens site and make the webdashboard changes.
- Then in your NAnt build script simply add a <style /> task after the <exec /> task for SourceMonitor as shown.
<!-- Execute the commands -->The <delete /> task is to clean up the sourcemonitor project file. The file grows over time so leaving it around on a busy build server is probably not a good idea and will just fill up space.
<exec program="${sourcemonitor.executable}" commandline="/C ${sourcemonitor.input}" failonerror="false" />
<style style="SourceMonitorSummaryGeneration.xsl" in="sm_details.xml" out="sm_top15.xml" />
<delete file="${codemetrics.output.dir}\sm_project.smp" failonerror="false" />
- Make sure you include the _sm_top15.xml file in your ccnet.config <merge /> task then build the project and you should see some numbers.
<xsl:when test="position() < 16" />and change the value 16 to 31.
Also, if you have nesting that goes to 9+ levels, then the summary won't show it. To get this showing you need to change the data-type to "text" in the Nesting Metrics section as shown here:
<xsl:sort select="metrics/metric[@id='M12']" order="descending" data-type="text" />Finally, you might want to change the labels in the dashboard.config and xsl\sourcemonitor.xsl files to reflect that you are showing a Top 30
Update: Eden has since fixed the stylesheet errors and made it easier to customise the number of items to show. Thanks mate!