I’ve recently fallen in love with a simple TeamCity feature. The ability to fail a build on changes in metrics in comparison to the last successful build.
If you, like me, are working with an existing (dare I say, “legacy”) code base, the effort to get everything cleaned up to a minimum standard can be daunting. I’m using FindBugs for static analysis, and while I would like to be at zero errors and warnings, I don’t have the luxury of just stopping all development and doing nothing but fixing them.
And is that even a luxury? Sounds like a rather tedious and soul-crushing exercise.
So, what I’m doing instead, using the TeamCity build to incrementally ratchet the number of static analysis issues/warnings steadily toward zero by making it impossible to for that number to increment, only decrement.
Now that I’ve got this particular quality safety net in place, we can just tidy up code as we go along. Sometimes when waiting on someone or something else, I go through the warnings and fix the easy ones.
I can imagine if you’re in a really nasty legacy code situation, where you have tests that don’t work, you could do the same thing with failing tests, eventually pounding down the number of test failures to zero.