I’ve been using Atlassians’ Bamboo CI server for quite a while now. While it integrates tightly into all the other great Atlassian products like JIRA, Confluence or Fisheye – I have (had) some grief with it after switching from Hudson:
Bamboo is first and foremost a CI server for Java based projects. While it has been sporting support to build C# / .NET based projects for a while now, it has a lot less plugins for this platform.
Where I work we were avid fans of the Violations plugin for Hudson. It looks for data generated by static code analyzers such as PMD or Checkstyle, parses the files generated by these plugins and provides this information in a nice way on the build server’s website. The Violations plugin also supports C#/.NET tools such as StyleCop and FxCop.
Since switching to Bamboo me and my colleagues found it more difficult to keep up our software quality standards which means no StyleCop and no FxCop errors/warnings in our production code! Luckily I could convince the team to make some time for me to develop a Bamboo plugin which parses StyleCop information.
So here it is for you to enjoy: download here
What the plugin does:
1. Look for all files defined by a search pattern, e.g. “build-reports***StyleCopViolations.xml” would find all xml files ending with StylecopViolations in all sub-directories below the “build-reports” directory.
2. Parse all found files, noting the total number of StyleCop violations
3. Add up all violations, calulate a delta to the last successful build
4. Present the information on a page in Bamboo’s web interface on a per-build basis
Throw in some color coding and you can instantly see which VS projects have how many StyleCop violations.
To achieve aforementioned result you will have to configure StyleCop to generate one XML file per VS project. I have added a target file for integrating StyleCop into your build script which does that.
You can call MsBuild from NAnt so that it uses this target file like this:
[sourcecode language=”xml”]
<msbuild project="${solution.file}" target="ReBuild" verbosity="Quiet">
<property name="Configuration" value="${solution.configuration}" />
<property name="CustomAfterMicrosoftCommonTargets" value="${path::combine(project.base.dir, global.stylecop.target)}"/>
<property name="StyleCopEnabled" value="true" />
</msbuild>
[/sourcecode]
For more information please refer to the wiki page of the StyleCop plugin on BitBucket.org.