代码审查 Review Board

liuxue.gu@hotmail.com · 2009年10月28日 · 25 次阅读

Review Board is good software(Review Board 好软件) 我在几个不同的公司都试图做一些有益的代码审查的事情,尝试然后失败,很羡慕 Google 基于 Web 的代码审查工具——Mondrian。我一直在寻找能使代码审查更无痛一些的工具。Review Board 就是我要找的东西。

代码审查有时就意味着午餐会上把可怜的工程师的代码放到投影仪上,赤裸裸地被所有工程组的人审查。这对任何人来讲都不是愉快的经历,其产生的后遗症以及心理阴影甚至会使下一次会议日程几周或几个月都定不下来。公开谴责也许有作用,但那是最后的办法,它会使很多好事情都不能启动。

然而好的代码审查——很难得——能产生非常好的效果。找到一个人逐行仔细地检查你的代码并提出建议和学习如何改进代码一样不容易。我曾经对执行严格代码审查的团队的工作结果印象深刻:既然一切都清楚易懂,在代码中作改变和 bug 修改就会简单。出色的代码审查会使 bug 更简单。

已经有一些基于 Web 的代码审查工具。Mondrian——不是 Google 的人不能用,Codestriker(Perl 的)发布也有一段时间了,还有 Atlassian 的 Crucible,界面很漂亮还有很多好的功能,不过起始价就是 2,400 美元,还得加上 FishEye 服务器。 我花了很多时间来配置 Crucible,不过还是决定再找找有没有其它选择,结果发现了 Review Board。这是一个基于 Django/Python 的开源项目,看起来社区很活跃也能快速响应。文档少一些不过你仍然可以花比折腾 Crucible 少得多的时间就开始工作。用户界面不是很漂亮但可以用,以及 iPhone/JSON API/Git & Mercurial & SVN & Perforce & CVS 这些支持都让我眼前一亮。还有,我很喜欢 Review Board 允许 pre-commit 审查,这一点 Crucible 还做不到。

如果你给 Review Borad 提交补丁就会领教为什么说这是一个伟大的开源项目。其所有补丁当然也需要经过 Review Board 审查,不会放过任何小瑕疵。我的第一个补丁立即就被拒绝了,后来的(比如这个)也不行。我已经从审查评论中学到一些技巧,而且我绝对要多花一些时间把代码搞好再提交。

看看项目启动文章你会了解作者们在做什么。我在办公室装了 Review Board 准备试试看怎么样。在这个领域能看到这样一个健康的项目太好了,我希望它能继续成长,良好发展。

Marc Hedlund 03.31.2008 After having tried and failed to have useful code reviews at several different companies, and after feeling deep envy for Mondrian, Google's web-based code review tool, I'd been looking for some tool that would help make code reviews more painless. I think I've found what I was looking for in Review Board. Code reviews usually amount to infrequent lunchtime sessions where some poor engineer's code gets put on a projector and strip-searched by the whole engineering group at once. It's not a fun experience for anyone, and post-traumatic stress or severe empathy often result in the next session mysteriously taking several weeks or months to make it onto the calendar. Public humiliation has its place, perhaps, but as a last resort – attempts to make it regular, good sport usually fail on the launchpad. Yet good code reviews – as hard as they are to find – can produce great effects. There's no better way to learn how to improve your code than to have someone look over it carefully and make suggestions line by line. I've been impressed by the results that teams using careful code review report: that making changes and fixing bugs in the code is relatively easy, since everything is fairly clean and accessible. Great code review makes bugs more shallow. There are a few web-based tools for code reviews. Mondrian isn't available outside of Google, but Codestriker (Perl-based) has been around for a while, and Crucible from Atlassian has a nice UI and good features – but a US$2,400.00 starting price point, including the required FishEye server. I spent a ton of time getting Crucible set up, but before taking the plunge I decided to take one more look for alternatives, and stumbled on Review Board. It's a Django/Python-based open source project, and it seems to have an active and responsive community. The documentation for getting it set up is a little thin, but it still took far less time than Crucible to get going. The UI isn't quite as nice, but it's serviceable, and the iPhone/JSON API/Git & Mercurial & SVN & Perforce & CVS support all turned my eye. Also, I like that Review Board allows pre-commit reviews, which Crucible as yet does not. You can immediately see why Review Board is going to be a great open source project when you submit a patch. All patches are, of course, code reviewed using Review Board, and nobody working on the project is going to let a minor glitch go by. My first patch got an immediate “no way”; later patches (such as this one) were up to snuff. I've learned a couple of tricks already from the review comments, and I definitely am spending more time getting things right before submitting. Take a look through the project launch post and you'll see what the authors are going for. I have Review Board set up at our office, and I'm psyched to give it a try and see how it goes. It's great to see such a healthy project in this area, and I hope it continues to grow and go well.

Review Board 起源于 VMware 的一些开发者。它基于 Django,你可以把它安装在自己的服务器上,工作流和 Rietveld 极为类似。令人高兴的是它提 供了在 diffs 里进行语法彩色编码,使得代码阅读变得简便。此外,它还实现了基于 Lucene 的搜索来帮助管理较大的 diffs 组。

项目地址: http://www.reviewboard.org/

最新版本下载 ReviewBoard-1.1alpha1.tar.gz

For too long, code reviews have been too much of a chore. This is largely due to the lack of quality tools available, leaving developers to resort to e-mail and bug tracker-based solutions.

We've seen a lot of time and energy wasted doing code reviews both in open source projects and at VMware. In both cases, code reviews were typically done over e-mail. A significant amount of time was spent in forming review requests, switching between the diff and the e-mail, and trying to understand what parts of the code the reviewer was referring to.

In an effort to keep our sanity and improve the process both in our open source projects and at companies, we wrote Review Board.

Review Board is a powerful web-based code review tool that offers developers an easy way to handle code reviews. It scales well from small projects to large companies and offers a variety of tools to take much of the stress and time out of the code review process.

需要 登录 后方可回复。