AI code review

Code reviews are one of the most important aspects of the development process. They help to catch defects early, even before pushing code to QA.

Although code reviews have remained beneficial to developers and their work, the way they are performed has drastically changed in the past decade. Before, a developer would schedule a meeting with a couple of other developers. They’d discuss the implementation for about an hour and change the code if needed, based on the feedback. This transitioned into doing code reviews via pull requests, where a bunch of developers would review the code through a version control system and then approve it to merge the changes with the main branch.

Now, there is a new trend in how teams perform code reviews: using artificial intelligence (AI). To understand how AI has impacted code reviews, let’s first discuss what benefits and problems currently exist with human code reviews.

The current state of human code reviews

We already know that code reviews help catch defects early and save time, cost and effort. But what are the benefits of doing strictly human code reviews?

First of all, it helps increase transparency by enabling your team to get an idea of your coding style. This is a great way to increase credibility, learn new approaches, and become familiar with coding standards.

Second, it helps software testers better understand how developers implement features. They may even learn the programming language and plan their testing accordingly. Of course, before conducting code reviews, various tests need to run to ensure the code is stable enough to review. These tests may include static code analysis and automated unit tests.

But there is a downside to human code reviews. There is a high degree of subjectivity. A study found that only 13% of pull requests are rejected due to technical reasons. Code written by junior developers does not receive priority compared to code written by experienced developers. This is an organizational problem, but it is also common among teams for several decades now.

Also, not all developers are confident enough to discuss their code with other experienced developers. They have a fear of being ridiculed or judged for the work they have done in front of everyone.

AI can minimize these limitations

Applying AI to code reviews reduces subjective problems that stem from human interaction. AI can also scan large amounts of code and give insights into it quickly, saving time for developers.

Several tools have come out in recent years that help apply AI in code reviews. DeepCode scans thousands of lines of code in real time and gets results immediately. It can scan code written in Java, JavaScript, C/C++, TypeScript and Python. The tool has scanned over four million developers’ code since its inception and found various interesting insights, including that over 50% of code repositories have crucial issues, and every other pull request has issues that need to be fixed.

Amazon also recently released its own AI-powered code reviewer called CodeGuru. The tool has already scanned millions of lines of code through open source applications and is trained to locate vulnerabilities that would otherwise be hard for a human to find. It can give intelligent recommendations to improve your code quality, proactively fix security vulnerabilities, and identify the most expensive lines of code. These insights can save organizations a considerable amount of money. Currently, CodeGuru supports Java and Python code stored in GitHub, GitHub Enterprise, Bitbucket and AWS CodeCommit repositories.

What’s next?

The use of AI in code reviews is still evolving. It is new to most of us, so we do not know whether we can trust the results from these tools yet. But we do know that humans are fallible and can miss things, so moving forward, maybe we can try using AI-powered code reviews as a complement to our existing processes. The more we use them, the more confident we will get in their performance and results.

As the world moves toward AI-powered everything, it only makes sense to start using these technologies so we can become smarter with code reviews. The advancements in AI look promising enough to make this the wave of the future. Instead of resisting it, let’s embrace the potential and move forward.

All-in-one Test Automation

Cross-Technology | Cross-Device | Cross-Platform

About the Author

Raj Subrameyer is an international keynote speaker, writer and tech career coach with a rich technical background. In his blog, rajsubra.com/blog/, he posts inspirational news, resources, and updates to help his readers lead a better life.

You might also like these articles