Code reviews in the age of AI
Before diving in, I want to emphasize what I believe about code reviews: they are not just about catching bugs. They are a crucial tool for knowledge sharing and improving engineering practices.
A strong code review process should be peer-driven, not just a top-down approval mechanism where senior engineers rubber stamp pull requests. When done right, code reviews help engineers at all levels learn from different implementations, challenge assumptions, and gain a deeper understanding of the system.
Code reviews are not just about catching bugs. They are a crucial tool for knowledge sharing, challenging assumptions, and raising the engineering bar.
Now, with AI-powered coding assistants generating more and more code, strong code review skills are more critical than ever. Whether code is written by a human or an AI, the ability to spot potential issues, architectural concerns, and security risks remains an essential skill for software engineers. Whether code is written by a human or an AI, the ability to spot potential issues, architectural concerns, and security risks remains an essential skill for software engineers.
If your process requires a senior engineer to approve every pull request just because of their title, without adding real value, then maybe that process needs to be reconsidered.
GitHub vs Google
Last week, we saw two main players unveil their AI-powered code review solutions:
- GitHub Copilot Code Review
- Google Gemini Code Assist
Both can be integrated into your GitHub repository to provide AI-powered feedback on pull requests. These AI reviewers offer a fresh set of eyes and can be useful for gaining an external perspective, such as feedback from a different LLM. However, I still believe the most important aspect is updating AI assistant code generation rules to ensure robust code from the start.
I've tested both. GitHub Copilot Code Review generally provides more relevant and insightful comments, aligning well with best practices and common code quality improvements. Google Gemini Code Assist is interesting, but quite often it confidently says, "There are areas for improvement" and doesn't provide any details on what those areas are.
Where AI reviews fall short
AI-driven reviews aren't perfect. While they excel at catching syntactic issues, code consistency, and best practices, they struggle with:
- Understanding architectural trade-offs
- Validating business logic
- Making nuanced design decisions
This is why AI should enhance, not replace, human reviewers. A well structured and maintainable codebase benefits both developers and AI powered tools. Clear, consistent code not only makes it easier for human reviewers to understand and collaborate but also helps AI models generate better code that align with your coding standards and best practices.