October 15, 2013

The Eyes of a Ranger are Upon Your Code.

Helix Swarm

Image: shankarrana13 w/Flickr

Clearly having your peers review your code is a huge win for software quality in an organization. It helps disseminate knowledge between team members and a second set of eyes is a great way to keep bugs from going to QA. But what if you had a code review tool that could bring in experts in excellence to give your code a thorough review? Someone who is as fair as a Texas ranger and has the calm of a martial arts master? Someone like Chuck Norris.

At our recent hackathon on the USS Hornet George Georgiev, the dev lead for the Office merge team, wrote a line by line, regular expression based static analysis tool that would analyze C++ code and update a Swarm review with appropriate comments from the Internet's favorite martial artist.

At first I saw his extension as purely performance art, but after thinking about it there's some merit to integrating a static analysis tool directly into the code review process. Static analyzers are wonderful tools, but sometimes their suggestions are not applicable, or are debatably applicable. Working on Git Fusion we had more than a few email threads discussing the results of the latest pylint and pychecker runs. If those results had been automatically added as comments we could have had our discussions in a central location with the code easily available for review.

Even if you don't want to have Mr. Norris commenting on your code quality, George's extension for Swarm gives a great example of how you can add comments to your review from outside of the standard interface. George has made the code available in the Perforce Workshop. Grab a copy of it and remember:


In the eyes of a ranger,
The unsuspected stranger
Had better know the truth of wrong from right,
Cuz the eyes of a ranger are upon your code,
Any wrong you do he's gonna see,
Whether you're coding in PHP or you prefer node,
Swarm is where the rangers are gonna be