Zero Warning Culture in Development Team


A code repository should target ZERO warnings. The compiler warnings are there to warn you about the code quality and sometimes more serious issues. Half year ago, our code-base has around 1600 warnings. Most of them were: (1) variables declared/assigned not used. (2) general exceptions (3) unreachable code (4) method hides inherited member so use keyword new or override.

With the help of Jenkins Continuous Integration Server, the number of warnings are recorded and plotted along each build. We have achieved the absolute-zero warnings today although some warnings complained by Visual Studio are quite tricky (e.g. project dependency, assembly version compatibility, not related to source code).

number-of-warnings Zero Warning Culture in Development Team c # continuous integration (build server) powershell

number-of-warnings

We have now added the following PowerShell build script to make sure no one introduces any single code warnings in the future. Warnings are treated as errors, marking builds failure.

if ($warnings -gt 0) {
    Write-Host "MSBuild has $warnings warnings"
    throw "Too many warnings!"
}

If any developer introduces code warnings and submit to code repository, which will fail the CI server.. and our culture is, he/she should buy donuts for everyone in the team!

Update:. A week later, we have so many donuts!

donuts Zero Warning Culture in Development Team c # continuous integration (build server) powershell

donuts for breaking the build!

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
327 words
Last Post: Disable P2P - Windows 10 Update Stealing Your Network Bandwidth
Next Post: NCrunch - Automatic Unit Testing Tool for C#

The Permanent URL is: Zero Warning Culture in Development Team

Leave a Reply