As an engineer coming from Google where every line of code is reviewed by another engineer before it is submitted, I had assumed that there would be a publicly available open source tool to help us facilitate code reviews in a similar fashion outside of the Googleplex. As it turns out, there are very few available and almost all are for doing code reviews post-commit. This includes the code review tool built into Google Code Hosting. Google Code recommends that you submit to a branch and then request a code review of the branch before merging into trunk. While that method certainly works, it's cumbersome and the overhead is too high. What inevitably ends up happening is nobody ends up requesting code reviews and the whole process gets dropped.
In my experience, the only way to make sure code reviews actually happen is to enforce it in your tools. But that's a post for another day. We don't enforce code reviews here at Adku because we don't feel that code reviews should be mandatory just yet for a three person startup, but you can bet that once we get bigger, we will.
Anyway, after hours of searching and experimenting with various tools, we settled on Rietveld which was developed by Guido van Rossum, author of Python and Mondrian. The problem with Rietveld, however, is that it doesn't work out of the box! It is meant to be run on appengine, but only supports Django 1.1 so you have to change your appengine setup to use Django 1.1 and this is not a trivial process. Moreover, if you run Rietveld on appengine, most of your changes will be available publicly with no way to restrict access to your internal team without diving in and modifying Rietveld source code.
In the end, after a bit of troubleshooting, we successfully got Rietveld up and running and even set it up internally to restrict access.
Now that it's up, it is beautiful, works great, and is exactly what we were looking for. Typical use looks something like this
- make some local edits
$ vi my_source_code.py
- send the changes to carlos for code review
$ python rietveld/upload.py --send_mail -r carlos
- carlos gets an email that looks like this
Date: Thu, Nov 4, 2010 at 11:19 AM
Subject: better demo (issue24)
Please review this at http://rietveld:8000/24/
- carlos clicks on the link and sees the unsubmitted changes in a web ui with change highlighting, syntax highlighting, and an inline commenting ui
- carlos enters a few comments inline with the changes and hits send
- i make the changes suggested and re-send the code
- he reviews again and hits approve
- i submit the pending change in my local client