Search code examples
c#continuous-integrationresharpercruisecontrol.netstylecop

How to Tighten the Quality Ratchet with CI


My team is in the process of getting Continuous Integration working with all of our projects. Right now we've got CruiseControl building all of the projects, which is...nice, but not really THAT big a deal. I'm seeing much more bang for our buck from NUnit, StyleCop and Code Analysis / Resharper.

But here's the thing I'm considering...so I turn on StyleCop for a project, and it has seven hojillion violations. And it's going to have seven hojillion violations until they're all fixed. In the meantime, do I just have a broken build? Doesn't this potentially obscure much more important build breakers?

It seems to me that what would be ideal would be a tightening ratchet on a project basis...Customer A is brand new, so every rule we have is enabled and breaks the build. Customer B is legacy, so their violations only trigger warnings, and we hope at some point we can tighten their ratchet all the way, like Customer A.

Does this concept exist in CI? How can I best implement it?


Solution

  • I've not played with StyleCop, but with FxCop (another analysis tool from Microsoft) we create two different ruleset - one we use to fail the build, and one that won't. The one that fails the build is a relatively small set of rules (unused code, undisposed fields, etc.) The one that doesn't fail the build has things like spelling and casing - items that are not important enough to fix now (or have so many violations that it would take forever to fix them all.)

    When the build runs it calls FxCop twice, once for each ruleset. Since we use msbuild to run our tools, we set the "FailOnError" flag to false for our warning set. This lets us see the results, but ccnet will not fail the build, regardless of how many violations we might have.