DEV Community

Cover image for Reference Guide: Conducting a Code Review
kymiddleton
kymiddleton

Posted on

Reference Guide: Conducting a Code Review

Code review is the process of reviewing and approving code changes for collaborators, someone other than the author of the pushed changes. It's basically code inspections conducted by peers working on the same project with a protected master branch. For more details on the code review process and benefits check out my post here.

When a notification has been received to review changes, go into GitHub and access the project repository.

Select the Pull requests tab.

  • A number next the Pull requests tab indicates the number of requests pending review.

Pull Request

Select the Pull requests from the listed items.

Pull Request

Once the Pull requests has been selected a new page will display several details:

  • Number of commits to be merged
  • Number of files changed
  • Contributors branch name

Before continuing in GitHub, make note of the contributors branch name and return to the terminal. Once inside the projects root directory:

  • git fetch origin <branch name>
  • git checkout <branch name>

From here, run the application to identify any potential issues.

Go back to GitHub to review the code changes in the pull request.

  • Select the Commits tab or the Files changed tab

PR Commits

Commits tab

  • This tab displays the history of the commits submitted for the specified pull request
  • Each commit can be selected to review the progression of changes made

Files changed tab

This tab provides a side by side comparison of the file changes.

  • New changes are on the right-hand side highlighted in green.
  • On the left-hand side, old changes are highlighted in red

The next step of the process will be to complete the pull request review. That process will provide the opportunity to make comments, approve the reviewed changes or request changes to be made before it can be approved. Therefore, if any issues were identified when the application was checked out and run locally be sure to make notes of the specific issues identified. If there is something noticeable when looking at the side by side view in the Files changed tab also be sure to mention specifics in the next step of the process Complete and Merge a Pull Request.

For the completed Reference Guide Series:

Discussion (0)