How to Prepare for Code Reviews

Here are some actions you can do on your own to ensure a successful code review session.

Oren Cohen
3 min readOct 30, 2022

--

Photo by John Schnobrich on Unsplash

Are you new to code reviews? Always feel like you mess them up in one way or another? Today I have some essential tips for you to prepare for code reviews properly.

The correct way to prepare for code reviews is to make sure you can review your code first, eliminate any mistakes you made along the way, test that the code is doing its intended function, and make sure it upholds your team’s code standards. Let’s dive into these more in-depth.

Review Your Own Code First

Most development teams use git tools like GitHub, GitLab, or some other git repository to review your code with or without you.

So, if you use GitHub, your process may look like this:

1. Write code.

2. Test code.

3. Open PR and assign reviewer.

4. According to the review answer, merge or fix.

From now on, you’ll add a slight change and add a Draft PR. This means you already open the PR but as a Draft. In other tools, that might mean you have to prefix the name of the PR with “WIP:” or something similar.

Just don’t add your reviewer yet.

Creating such a draft PR will allow you to be your own reviewer first. You will have all of your code in plain sight and can see what you pushed on your branch. Maybe there is some code you added for development purposes? Now is the time to get rid of them.

Test Your Code Before Sending It To Review

You’ll be amazed how often a small change can cause an entire service to malfunction. You don’t want to send for a review when your code is causing the service to crash on startup. And believe me, that happened to me multiple times while developing microservices in the past.

Do yourself and your reviewer a favor and test that your code works. Don’t have CI/CD at work that automatically builds your code (for example, docker images)? That’s on your DevOps more than it is on you. You’ll have to do it the hard way by building a docker image…

--

--

Oren Cohen

Software Engineer and Blogger. He/Him. Contact me: oren@thegeekwriter.com

Recommended from Medium

Lists

See more recommendations