REFLECT

Code review

Maintain code quality and reduce defects by having team members proofread for errors.

Slow down to go faster

Code review is the practice of team members reviewing and discussing other team member’s code change in order to build confidence in the change before it’s merged. Based on the reviewer’s comments, the code can be updated and reviewed again, until it is as good as it needs to be for the long-term success of the project.

Code reviews are best done in small batches. We recommend performing a code review for every pull request a team member makes. Done regularly, code reviews can maintain or elevate the quality of the code that ends up in your offering, streamline your development process, drastically reducing the amount of time spent on defects and quality assurance.

While a code review can be as informal as having a colleague look over your shoulder at your desk, we recommend a GitHub Enterprise-assisted technique that helps track and document the outcome of a review.

Recommended tools

Remote

  • GitHub Enterprise
  • Email

Step-by-step

1) Choose a pull request

Depending on your team’s process, you might be asked to review a specific pull request, or you might volunteer to take the oldest PR in the queue.

2) Understand intent and extent

Before you get started, read the provided description of the user story or task to understand the context of the pull request. Look at previous comments and check to see if all outstanding comments have been addressed.

To better understand the overall change before you dive in, check to see all of the files that were touched. The smaller the pull request, the easier it is to review.

3) Pull the code and test it

Pull down the code and run it yourself to see if anything major breaks. If the changes are complex or you’re unsure about the context, ask the submitter to personally walk you through the work.

4) Review the code

Review the code line-by-line to check it against your team’s standards, and add comments as needed. These comments should be discussed and addressed before the PR can be merged.

5) Verify and merge

At the end of the review, indicate your approval with a +1. If it needs another review, post Looks good to me (LGTM) so that another team member can pick it up. Once the pull request has been sufficiently reviewed, feel free to merge it.