Quality Gates Work - If You Let Them

by g. ann campbell|

    Some people see rules - standards - requirements - as a way to hem in the unruly, limit bad behavior, and restrict rowdiness. But others see reasonable rules as a framework within which to excel, a scaffolding for striving, an armature upon which to build excellence.

    Shortly after its inception, the C-Family plugin (C, C++ and Objective-C) had 90%+ test coverage. The developers were proud of that, but the Quality Gate requirement was only 80% on new code, so week after week, version by version, coverage slowly dropped. The project still passed the Quality Gate with flying colors each time, but coverage was moving in the wrong direction. In December, overall coverage dropped into the 80's with the version 3.3 release, 89.7% to be exact.

    In January, the developers on the project decided they'd had enough, and asked for a different Quality Gate. A stricter one. They asked to be held to a standard of 90% coverage on new code.

    Generally at SonarSource, we advocate holding everyone to the same standards - no special Quality Profiles for legacy projects, for instance. But this request was swiftly granted, and version 3.4, released in February, had 90.1% coverage overall, not just on new code. Today the project's overall coverage stands at 92.7%.

    Language Team Technical Lead Evgeny Mandrikov said the new standard didn't just inspire the team to write new tests. The need to make code more testable "motivated us to refactor APIs, and lead to a decrease of technical debt. Now coverage goes constantly up."

    Not only that, but since the team had made the request publicly, others quickly jumped on the bandwagon. Six language plugins are now assigned to that quality gate. The standard is set for coverage on new code, but most of the projects meet it for overall coverage, and the ones that don't are working on it.

    What I've seen in my career is that good developers hold themselves to high standards, and believe that it's reasonable for their managers to do the same. Quality Gates allow us to set - and meet - those standards publicly. Quality Gates and quality statistics confer bragging rights, and set up healthy competition among teams.

    Looking back, I can't think of a better way for the C-Family team to have kicked off the new year.