It’s 2022. The benefits of code reviews are no longer debated. And automating that process has become one of the hottest trends in engineering.
In the last few years, there has been an explosion in automated code review tools. And many in the industry are comparing what code review tools are doing for engineering to what Salesforce did for sales.
That’s a lot of hype. So what are the benefits and which tool is best for your company? Get in loser, we’re automating our code reviews.
Table of Contents
- What is Code Review?
- Benefits of Code Review
- Why Use Code Review Tools
- 3 Popular Tools to Automate Code Review
What is Code Review?
Code review is a technique that helps engineering teams improve the quality of the codebase through collaboration. It’s a process by which multiple developers work together to evaluate each other’s code. The resulting peer review process naturally reduces mistakes.
Benefits of Code Review
Excellent software doesn’t happen by accident. Code reviews should be an essential focus for engineering organizations that want to ship faster.
Code Reviews Improve Code Quality
Preventing bad code from making it to production is the most obvious of several benefits. Just like with writing, having a second set of eyes on your code can help prevent errors and find bugs. It can even prevent unnecessary code duplication.
Additionally, code reviews can ensure your project has a consistent coding style, as well as software design and implementation.
Code Reviews Share Knowledge
Another often overlooked benefit of the code review process is its ability to improve the individual skill of developers. By allowing developers direct access to feedback from their peers, a collaborative code review process raises the skillset of all the development team members.
Being willing to make mistakes and accept feedback is also an important part of team culture that code reviews can contribute to. Check out what Hyrum Wright and Titus Winters, Senior Google Staff Engineers, say about how everyone makes mistakes and that it’s okay to be willing to be open and learn from them.
Code Reviews Save Time
It sounds a little backward, right? Do more steps to get faster. Some orgs operate with no code reviews. But there are flaws to this approach.
Every hour your team has to spend working on a bug, reworking code, or refactoring code is an hour lost to developing new features and delivering business value. It is much quicker and cheaper to invest the time in code reviews upfront.
Why Use Code Review Tools
The old school way of performing manual code reviews by having a team lead walk over to your desk and guide you through the process has become a relic of days gone by. Even the more modern approach where code reviews are performed via email has become outdated.
In a distributed world where engineering teams are often thousands of miles away and continents apart, code review tools have become the new normal. And even if your engineering team is co-located you run the risk of falling behind if you haven’t switched to a tool yet.
Tools improve speed and accuracy. Ideally, these tools integrate with your existing stack and software development process so that they don’t disrupt your flow.
For example, many Git tools already include pull requests to initiate the code review process. A pull request lets you discuss and review the code changes with collaborators before your changes are merged into the base branch.
But this is still a fairly manual process that can result in significant delays in review time. What happens if no one picks up your pull request? What happens if your reviewer just scans the code and says LGTM?
Do you merge without a review or with just a basic review? If so, then what was the point of the code review at all if there’s still a high risk of bugs being introduced into production.
For this reason, a new set of automated code review tools have emerged on the market. Automated code review tools have two primary benefits:
- They help your developers get back to coding, rather than reviewing, faster.
- They assist with better code quality and shorter cycle time.
Let’s look at 3 of the most popular options available.
3 Popular Tools to Automate Code Review
1. WorkerB for Pull Request Chrome Extension
This free Chrome Extension helps you collaborate with your team and get your pull requests reviewed faster…like 10x faster! It doesn’t entirely automate your code reviews, but it enriches your PRs with context that helps your teammates pickup and review faster.
When you create a pull request on GitHub, you’ll see your PR review time estimated by WorkerB on the right panel.
Click “Copy link” to generate a link with context about your PR. Click “Personalize” to review and edit your message. Add a personal message and a GIF. Then paste the link in Slack and watch the reviewers come running. Receive Chrome notifications every time someone peeks at the changes tab on your pull request, adds a comment, approves and more.
2. WorkerB + LinearB
More extensive versions of WorkerB are also available with all 3 tiers of LinearB. WorkerB is the magic behind improving the metrics tracked in LinearB.
Not only can you track metrics like cycle time, PR size, PR pickup time, and review time, but you can customize goals to streamline your code review process across your team. And get your team using automated WorkerB Slack or MS Teams alerts to improve metrics organically.
In our data analysis, we also found that developers wait on average 4 days for a pull request review and small PRs that would wait for days to be reviewed would result in a “Looks good to me” type comment 80% of the time. Why are we waiting days to merge an LGTM PR?
Now you can use WorkerB to route PRs with <5 lines of code changes into Slack and MS Teams for immediate review and approval. This simple, yet needed, feature takes a snapshot of your PR changes, and sends them via DM to the assigned reviewer so they can approve almost instantly.
As we’ve learned, not all PRs are created equal. And gitStream takes PR routing to a whole new level. It allows you to create a clear set of rules and policies at the repo level that automates how code gets merged. Visible in the IDE, developers understand how their PR will be treated and how to follow the repo policy.
Set up automations so code that needs extra attention gets it, and everything else is expedited. For example, some pull requests can be automated, like changes that are non-functional, like docs or tests, or even reformatting code. Other changes can be routed to specific people to review, approve, and merge.
Every time a dev opens a new pull request or changes a pull request, gitStream is triggered, and the .cm file is used to determine which automatic actions are invoked based on their conditions. The result is an increase in merge frequency and decrease in cycle time.
Want to learn how to implement custom dev workflow automation to cut code review time by up to 40%? Watch this hands-on workshop to set up the free gitStream tool to automatically:
Classify and route pull requests
Add estimated review time to PRs
Apply custom rules
gitStream product lead, Ofer Afias, will take you through a live demo of the three core functions when getting started with gitStream workflow automation to scale your team efficiently and improve your developer experience.