DEV Community 👩‍💻👨‍💻

Cover image for Code review best practices
Maxim Nosov ✪
Maxim Nosov ✪

Posted on

Code review best practices

Hi everyone,

This week I've been doing some code reviews for Telescope project.

I would love to share some tips for code review that I figured out.

I've reviewed 2 PRs. PR#1 and PR#2.

Don't take it personally

People review the code, not your personality. Project maintainers might be very strict. Hence, they might request changes for almost every line if they see it could be written better.

We have to remember that with code reviews we are just eliminating common mistakes and making ourselves better as developers.

Follow code review checklist

List at least 3 things you need to check in the code. For example, it could be the following:

  • Security

  • Reusability (e.g. can we reuse the written functions)

  • Code simplicity

Multiple reviewers

Code review is a team work, meaning it's better when multiple people review a little piece of code.

It will help to stay focused and not feel overwhelmed. As a beginner, If you review only 50 lines of code, it will be much easier comparing to reviewing 1000 lines of code, where at some point, you might lose concentration. Programmers are humans, not robots :)

Leave proper comments

In the comments, **leave clear and concise comments **about what should be changed and why it's a best practice.

Automate code styling

We need to use automation for repetitive tasks as much as we can. Use prettier and linter to make sure that code is easy to read.

If you enjoy blogs, you could buy me a coffee. It will motivate to write better blogs :)

What else do you think could be considered as code review best practice ? Let me know in the comments :)

Top comments (0)

We want your help! Become a Tag Moderator.
Fill out this survey and help us moderate our community by becoming a tag moderator here at DEV.