Code Review typically finds and removes about 65% of errors, up to 85%.

The primary function of Code Review is to improve Code quality: find unreasonable design, obvious logic errors, etc. In addition, Code Review can also learn other people’s good writing methods and get familiar with other businesses.

CR in the following refers to Code Review.

When is CR done

On many teams, the lead will do a CR before new features are modified or branches will be merged. This requires that you do not merge too many functions at a time. It is difficult to do CR for large code changes. Some teams encourage team members to cross CR.

There’s also regular CR. Team development members work together on CR. The organizer picked some code to do CR.

What CR

CR looks at the design of the implementation of code and functionality. Attention:

  • Are the data structures and algorithms selected appropriate?
  • How extensible are the late changes?
  • Code performance and security considerations.
  • Is it overdesigned?

In detail, attention should be paid to:

  • Is the code robust? Exception handling. Processing of edge cases. Whether existing code is affected. Whether there is high coupling.
  • Code readability checks. Is the naming reasonable? There are no magic numbers. Whether necessary notes and documentation are available.

What doesn’t CR do

Do not perform tool-enabled checks during CR. Such as:

  • Code style checks. Use the Lint tool to do this.
  • There are some objective code quality principles. For example, the maximum number of branches of conditional statements (cyclomatic complexity). Use the Lint tool to do this.

thinking

  • What if there is a conflict between the code author and Reviewer during CR?
  • How to do CR quickly? CR is too slow, which affects the overall team progress.
  • Cro for large code changes?
  • Under what circumstances should CR standards be relaxed?
  • Reviewer: What changes would be required for developers with limited coding skills?
  • How to write changes that developers can easily accept?

Did your team do CR? How did you do CR? Please share with us

Reference documentation

  • Google Official article – How to do code Review
  • How to Do Code Review the Human Way (2)