Solving Code Review Frustrations with CodeRabbit AI Automation 🤖

Solving Code Review Frustrations with CodeRabbit AI Automation 🤖

Speed up Code Reviews!

Published on Sunday, October 6, 2024

CodeRabbit is a new AI LLM-powered tool for automated code reviews. It integrates with platforms like GitHub, GitLab, and Azure DevOps to automatically review pull requests, thus giving developers suggestions and feedback. The setup is quick and can be done in less than 10 minutes. CodeRabbit can be used with any programming language.

CodeRabbit's key features are:

  • Pull Request Summaries - CodeRabbit generates a summary of changes, modified files, etc.
  • Sequence Diagrams - CodeRabbit automatically creates Sequence Diagrams in complex cases, helping developers visualize processes.
  • Suggestions for Refactorings
    • A lot of advice is similar to suggestions from static code analyzers.
    • Many pieces of advice are for improvements to specific programming languages and frameworks.
    • Coderabbit can detect potential bottlenecks and suggest performance improvements.
    • The most interesting advice I got was that I forgot to initialize property values for some components. The advice was from context, and AI could understand what I wanted to do. Another interesting case was that it found a problem with data generated from CSV. These mistakes were tricky to find manually.
  • Conversational AI - Developers can interact with CodeRabbit and ask for clarifications or check for new changes to the code.
  • Data Privacy - CodeRabbit does not store code on its servers.

The Problems with Code Reviews and Possible Solutions

What is the easiest way to ensure you will not get bad feedback during code review?

Make the commit so long and complicated that no one wants to do it!

We are all guilty of botching some code reviews. We understand the necessity, but they can be time-consuming and tedious.

Here are some of the problems and possible solutions with automated code reviews.

  • Context Switching - Code reviews can break developers state of "flow" when coding. CRs can create inefficiencies when switching from coding to CRs and back to coding.

    • Developers push small commits, request automated code review, and quickly get a response. No context switching! It's not necessary to call for other developers all the time.
  • Unclear and vague Feedback - Writing good and detailed feedback takes time. We, as developers, sometimes take a shorter route and skip good explanations.

    • If anything, LLM-based tools are suitable for writing detailed answers.
  • Waiting Time - Usually, we need feedback as soon as possible so we can continue with other, sometimes connected tasks. Waiting for CR from other developers can be inefficient.

    • Waiting time is minimal. But, we will still need to receive feedback from humans. However, it is less likely that humans will have suggestions because AI has already checked it and possibly found the first set of mistakes. Also, even people who do the review can better understand the code they must check.
  • Multiple Review Iterations - Sometimes, we need CR feedback in iterations. It takes even more time than regular.

    • You can interact with CodeRabbit and push partial commits.
  • Psychological Impact - Some developers could find it discouraging to hear feedback from other people.

    • Tools like CodeRabbit help with this, but this problem is essential to solve on a team level!

Human Touch and Code Reviews

However, we must also consider "a human touch." If team members communicate during code reviews, it can create a more profound trust within a team. Also, for younger colleagues, we have additional responsibility because it's not just about the project, the correctness of the code, and the goal of the task, but to mentor and teach.

I strictly disagree with having only automated code reviews! We should enchant regular "human code reviews" with AI but not replace human understanding of the broader goals and context.

The Future & Conclusions

CodeRabbit is free for Open Source. For private repos free tier includes just summary and release notes for each Pull request. For 12$/15$ per month you get "the Standard", and there is a custom Enterprise option and a Self Hosted variant. The Future of CodeRabbit looks promising. Two months ago, the company raised $16M in Series A funding (TechCrunch).

With so many advances in AI and programming, it's hard to predict how the development will look-alike in the following years. But, with my experience with CodeRabbit, I'm sure it will include automated Code Reviews! There's no reason not to use tools like this. It can help immensely with code reviews, especially the part that humans find complex and repetitive. If you are a solo developer, a second pair of eyes, even the AI ones, can significantly help.