Writing an Amazing Code Review Checklist

Written by jamesgallagher4 | Published 2018/10/22
Tech Story Tags: code-review | code-quality | software-development | programming | code

TLDRvia the TL;DR App

Code reviews are a necessary part of the software development process, designed to reduce technical debt and ensure consistency across your codebase. Everyone who writes code makes mistakes, but it is important to catch them before they reach production and start to cause damage.

The best way to ensure that your code reviews are as simple and effective as possible is to create a code review checklist that covers everything that you have agreed is important to ensure the maintainability of your code. This may include ensuring that best practices are adhered to, checking code formatting for errors, ensuring that tests are up-to-date with the latest commit, and implementing your team’s coding conventions and policies. Creating a code review checklist means you, and your whole team will have a codified reference point for your code quality, which will help streamline your code review process and ensure that the process is as refined as possible.

There is no one size fits all for code review checklists. Every developer and team has different requirements that are specific to their code, so please don’t use this article as your only guide. We have written this article to help you understand what we consider are the most important components of a good code quality checklist, which you can refer to when building your own.

Starting Point

In order to get started, we need to first consider the core checklist elements. Firstly, it is important that you check the implementation of your code, and ensure that your code performs the task it has been written to complete, in an efficient and concise way. If you feel like a shorter solution could be written, or the implementation is not efficient, then you should change it before you complete the rest of the checklist.

Make sure that you also check for any code that is no longer in operation, but has been used in previous commits and builds. This ensures that your codebase is clean and easy for your team to understand, and helps speed up the debugging process.

You should also consider reviewing your code’s overall performance. For example, are there any libraries that could replace functions or enhance your code? Are there any solutions out there which will reduce the need for additional functions? Check to make sure if there is any code left over from the debugging phase (such as logs or old functions), and remove it to ensure your code runs as fast as possible.

Code Duplication

This issue is way more common than you might think. Take some time to look for any copies of code that do the same thing in multiple functions, and create its own method if that is the case. This may be acceptable for only two instances, however, when you have the same code copied in 5 different files that do exactly the same thing, you should refactor it into a single, unified function.

Styling

Your code should not only be efficient, but it should also be easy for other people to understand so that any new developer can easily gain insight into the purpose of each line of code. Somewhere down the line, your code may need to be changed, removed, or refactored, and it’s important to make sure it is easily readable and understandable so that a developer can work with it without needing to ask you about it.

Some things you should consider when styling your code are:

  • Do my variable names make sense?
  • Are there comments in place to explain complex functions?
  • Does your code include long methods with too many branches that could be restructured into a more simple method?
  • Are you in adherence with your team’s spaces/tabs choice, and does your usage of white space make sense?

Security

Security should always be at the heart of the software development process. This consideration becomes significantly more important when you are dealing with personal information or using any third-party libraries or utilities. When a user shares sensitive information like passwords, it should always be encrypted and be in compliance with any validation set in place. In addition, all API keys, session tokens, and authorization facilities should be implemented in a secure way. If you are using OAuth, make sure you follow the standard to the letter.

Testing

As your codebase expands, testing (especially with regards to load and performance) becomes increasingly important to ensure that all code deployed to production is operational and as efficient as possible. All of your code should have accompanying test functions to ensure the stability of the code. You should consider checking overall continuous integration tests and ensuring that they pass all checks. Take some time to evaluate if your testing facilities need to be checked, and ensure that they are actually testing the entirety of the codebase. In addition, do your unit tests target the specific function they are attributed to, and does the test framework you have put in place to cover all potential use cases?

The importance of revision

Your team’s code styling will adapt over time, and so should your code review checklist. It is important that you continue to change your checklist as your code evolves and as you become more experienced, to ensure that it is covering every area of your code. If you have implemented a new linting procedure or testing process, then your code review checklist should reflect these changes.

It can, however, be very time consuming to plan and develop your own code review process. Your time is valuable, and by outsourcing your code review needs then you can spend less time worrying about the quality of your code, and more time writing code and shipping your product — which will benefit your entire team and company!

Open Commit is a Code Review as a Service network that allows you to outsource your code review to experts. We pair you with an expert software developer who will write an in-depth review of your code, covering everything listed in this article and more. We also allow you to discuss your code with our expert reviewers within your tools, so you can gain a firmer understanding of your review and gain additional insights into best practices you can implement in the future.

We hope this checklist has provided you with some clarity regarding the code review process, but it is far from comprehensive. Our final tip is to remember to continuously adapt your code review checklist to meet your needs. Happy coding! 💻


Published by HackerNoon on 2018/10/22