Tips for Code Reviews

laptop with code
Code Reviews :D

Title and Description

This is a bit obvious, but instead of immediately, jumping into “changes” and start reviewing, read the title and the description, could be some important stuff in there 🔥.

Overview then line by line

Before reviewing line by line, I enjoy skimming over the changes to get a better understanding of what has actually been changed and what I am reviewing. Then I go review each line of code that was changed, if I see something that I am unfamiliar with, I enjoy opening the unchanged lines and see if that particular function or variable was declared/imported somewhere else 😉.

Comments

No, I don’t think 😜. If there is something that is not clear to me or something I do not understand, I comment right away, usually, I click “start a review”, and just add all the questions and comments to the review. I do enjoy googling if I see something that I have not seen before or if it looks very interesting, could be a particular API for example 🏂.

How to write the questions and comments

First, be nice 💝. When I ask something, I usually try to ask it as an open question and not like I'm criticizing, i.e. “Curious, why is this particular abstraction needed here? What do you think of using this instead? It could help with the performance because…”.
I like asking a question, then proposing a solution that might be better (I could also be wrong 😝), then explaining why I would use my solution instead of the current one ❤️. Do not forget also, you are reviewing the code, not reviewing/judging the author of the pull request 😃.
I love emojis, I use them everywhere, even in code reviews 😆. In my opinion, emojis give the message somehow more life 🌞. This is not something I recommend, but if you wanna give it a try, go ahead haha 😄.

Test it locally

I enjoy testing the pull request locally too. This helps me not just understand the changes better but also play around a little bit and perhaps propose a concrete solution. I do not commit! This is not my pull request, and I think the author of the pull request has a better understanding of the changes he made and why he decided to do so, therefore I rather just propose a solution, either through Slack or just add it as a comment to my review. If there are changes that you can see, I start the server and see how it looks 👀.
When testing it locally, I copy the branch name from GitHub/GitLab, stash my current changes if I am working on something, checkout the master branch, pull from the master branch, and then checkout the branch I want to review.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store