gerrit(3) | gerrit code review 产品概况

gerrit(3) | gerrit code review 产品概况

本文是对 Gerrit Code Review Product Overview 的机器翻译, 然后增加了一点个人的看法。

Gerrit Code Review 是基于 Git 版本控制的基于 Web 的代码审查工具。

Gerrit Code Review 是个啥 ?

Gerrit provides a framework you and your teams can use to review code before it becomes part of the code base. Gerrit works equally well in open source projects that limit the number of users who can approve changes (typical in open source software development) and in projects in which all contributors are trusted.

在把代码合并到 code base 之前, 你可以用 gerrit 来做 code review。 gerrit 提供了 code review 框架, 在限制可以批准更改的用户数量(在开源软件开发中很常见)的开源项目和所有贡献者都受信任的项目中同样有效。
(gerrit 很能打的; 还不会 code review 的话, 来用吧)

Code Review 是个啥 ?

Code reviews can identify mistakes before they’re found by customers. In a world of continuous integration, code must be tested before it’s submitted to the master branch to become part of the code base. Tests confirm that a product works (and continues to work) as intended by the developers.

代码审查可以在客户发现之前识别错误。在持续集成的世界中,代码必须在提交到主分支成为代码库的一部分之前进行测试。测试确认产品按照开发人员的意图正常工作(并且继续正常工作)。

(写代码不是一件很随意的事儿 – 你得有测试代码, 你的修改必须通过测试, 通过测试后才能进入 master 分支。 换言之, code is cheap, show me your testcases, show me your changes can pass testcases.)

When code is reviewed, developers:

在代码审查时,开发人员:

  1. 认真而一贯地工作 (Work carefully and consistently)

  2. 从其他开发人员那里学习最佳实践和新技术 (Learn best practices and new techniques from other developers)

  3. 在整个代码库中实现一致性和质量 (Implement consistency and quality across the code base)

Code reviews typically turn up issues related to:

代码审查通常会发现与以下问题相关:

  1. 设计:代码是否设计良好,适合代码库? (Design: Is code well-designed and suited to the code base?)

  2. 功能性:代码是否按预期执行,并对用户有益? (Functionality: Does code perform as intended and in a way that is good for users?)

  3. 复杂性:其他开发人员能否理解和使用该代码? (Complexity: Can other developers understand and use the code?)

  4. 命名:代码中的元素,如变量、类和方法是否有清晰的名称? (Naming: Does the code contain clear names for elements such as variables, classes, and methods?)

  5. 注释:注释是否具体完整? (Comments: Are comments specific and complete?)

Learn Gerrit Code Review

如果是Gerrit的新手,想要了解如何通过Gerrit来提高工作效率,请参考:

  • How Gerrit Works
  • Working with Gerrit: An example
  • User Guide
  • Project Owner Guide
  • 补丁程序的生命周期

个人总结

如果写过糟糕的代码, 然后看了 Clean Code, Code Complete 这样的书, 又根据书上的指南重构了自己的代码,那么对于提到的很多 “目的” 都很清晰。

你可能感兴趣的:(代码复审)