Regardless if it is your first or 500th time doing a code review, there may be certain questions that you need some advising on. Instead of searching through Google for a checklist or a guide, we've decided to create one for you! Collaborator,
a peer code review tool, has set out to make the Code Review process easier, with these simple 12 steps to follow. Which of these best
practices is your team already doing regularly?
1
Set Early Expectations
With The Developer About Annotating Their Source Code Before The Review
By having the authors carefully read through and annotate their own code, prior to giving it to their team for review, fewer defects were found.
In our 2018 State of Code Review report, we found that respondents who said that they understand expectations on reviews are much more likely to be satisfied with the overall code quality.
2
Determine Quantifiable Goals
Prior To Code Review For Increased Accountability
By creating transparent goals, you increase the accountability of each member of your team. It's best to start with external metrics instead of something vague such as fixing more bugs.
Once you have key metrics established, you can identify team benchmarks and start driving meaningful process improvements.
3
Have A System To Capture Metrics
So You Can Improve Your Processes
Quantifiable Metrics allows you to judge how effective and efficient the code review process is for your team.
In our 2018 State of Code Review report, we found that teams who regularly view reporting on their process are 5x more likely to be satisfied with their code reviews.
4
Plan Enough Time
For A Proper, Slow Review But Not More Than 60-90 Minutes
After roughly 60 minutes, reviewers simply wear out and stop finding additional defects.
Teams that are in the habit of conducting shorter, more frequent reviews are more likely to release on time and be more satisfied with their overall code quality.
5
Peer Review Documents
So Your Whole Team is Aligned on Project Objectives
Conducting reviews on development artifacts like requirements, user stories, and design documents is a good way to ensure that your whole team understands the end goals of a project.
In our 2018 State of Code Review Report, we found that teams who review more types of documents also are more likely to be satisfied with their code review process.
6
Take 20 Minutes Breaks
In Between Review Sessions
Don't overwhelm yourself, it is best to inspect less than 300-500 lines of code per hour.
Studies show that the accuracy of finding defects during reviews is 5X times as effective when you review no more than 200 lines in one sitting.
7
Verify That Defects Are Actually Fixed,
Not Just Found
Thoroughly follow up with your defect-hunting. If it's not corrected, it's not truly "fixed".
Your code review process should be able to operate as a quality gate. If you are not able to enforce that defects are fixed, you may want to consider adopting a review tool or workflow that enables it.
8
Use Code Review As A Team Building Activity
Remember, Finding Defects Before Launch Is The Point!
It is up to the manager to foster a positive attitude about finding defects. Code reviews offer an opportunity for all team members to correct bad habits learn new tricks, and expand capabilities.
In our 2018 State of Code Review report, 73% of respondents said that code reviews help share knowledge across their team and 53% said that code reviews are used to mentor less experienced developers.
9
Don't Be A Back Seat Coder
Your team works hard at programming; don't make it harder by constantly watching them code and their every move during the process.
If you encourage a collaborative culture, developers will feel ownership of their code quality and your team will build trust over time.
10
Do A Certain Amount Of Code Review Each Day
Even If It's Not Every Line
A developer will be more conscientious of their own code before code-complete is declared it's known a team of developers will be reviewing the code daily.
In our 2018 State of Code Review report, we found that teams who conduct daily code reviews are twice as likely to be satisfied with their review process as teams who don't review code as frequently.
11
Use A Code Review Tool
For Even Greater Efficiency and Accuracy
To fully optimize the time your team spends on code reviews, a code review tool is recommended.
In our 2018 State of Code Review report, we found 79% of the teams that are satisfied with their code review process are conducting tool-based reviews, compared to 47% of teams that are unsatisfied.
12
Use Checklists
To Substantially Improve Results For Both Authors And Reviewers
Using a checklist like this one will remind the reviewer as well as the author to take the time to look for something that might be missing during the code review as well as helping to improve their personal coding skills.
If your team is working in a highly-regulated space, checklists can also be an easy way to build an explicit audit trail of who did what on each review.
Great! It looks like your team is following some of the best practices for code review. Consider adding some of the tactics that you didn't check to your team's process.
Fantastic! It looks like your team is following most of the code review best practices.
Read
"The 2018 State of Code Review"