Speed up your pull request review with CodiumAI PR agent
Tags: ai, productivity, programming
Published: 2023-12-12 16:03:33

Pull Request (PR) is an essential process in software development that ensures code quality and collaboration among developers. PRs are also a way to learn from others and get better at coding, a good PR process helps people work together better and keeps the code easy to use and understand.

## Problems with PR

However, PRs can be a bottleneck in software development lifecycle. Developers often face challenges such as large codebases, time constraints, and the need for thorough code analysis.

Here are some common problems of PR:

1. **Time Consumption(No time to review)**: Reviewers who are familiar with the codebase often do not have enough time to conduct a thorough review in a short period.
2. **Context Switching**: Reviewers may have to switch contexts frequently, especially if they are reviewing multiple PRs from different parts of the codebase.
3. **Feedback Fatigue**: Reviewers may experience fatigue, especially when dealing with a high volume of PRs, which can lead to less thorough reviews.
4. **Technical Debt and Bugs**: Identifying deeper issues like technical debt or potential bugs can be challenging, especially under time constraints.
5. **Unclear Descriptions**: If the PR descriptions are not clear or detailed enough, it becomes difficult for reviewers to understand the purpose and scope of the changes, leading to inefficient reviews.
6. **Coding style**: Inconsistencies in coding style and lack of adherence to best practices can lead to future maintenance issues.
7. **Large PRs**: ****Very large PRs can be overwhelming to review, often resulting in missed issues or superficial reviews.

There are several tools available to address these issues, such as **linters**, **automated tests**, and **contribution guidelines**. Additionally, **training sessions** can be beneficial if you are part of a well-resourced company (although they might not be as common in open-source projects)

## How AI Can Help

In November 2022, OpenAI launched ChatGPT, showcasing how AI, particularly through Large Language Model (LLM) APIs, can empower individuals and enhance the PR review experience.

Subsequently, numerous AI tools based on Large Language Models (LLMs) were developed to address the aforementioned issues. These tools have been created by both large enterprises, such as *GitHub*, *AWS*, and *Microsoft*, and startups, including *CodiumAI*, *BLACKBOX AI*, and *Tabnine*.

In this section, I will provide an extensive comparison of some of the most notable tools designed to facilitate PR reviews. This comparison will focus specifically on two key examples:

- From an enterprise perspective: **GitHub Copilot**
- From a startup perspective: **CodiumAI PR Agent**

### Comparison of CodiumAI PR agent and Github Copilot

I’m still in the waiting list of Github Copilot, so the Github part in this comparison table might change

|  | CodiumAI PR Agent | Github Copilot |
| --- | --- | --- |
| pricing | free | paid |
| opensource | ✅ |  |
| PR review | `/review` | `copilot:summary` |
| PR description | `/describe` | `copilot:walkthrough` |
| code suggestion | `/improve` | ✅ |
| interestring tricks | `/ask "your-question"` | `copilot:poem` |
| support code hosting platforms | github, gitlab, bitbucket, AWS CodeCommit, azure devops, gerrit | github  |
| Granularity | focus in PR | more general |
| website | https://github.com/Codium-ai/pr-agent | https://githubnext.com/projects/copilot-for-pull-requests |

CodiumAI PR Agent also includes commands such as `/update_changelog` for writing release logs, `/similiar_issue` to find identical issues in large codebases, `/add_docs` for more detailed descriptions, and `/generate_labels` to enhance documentation clarity.

### Real world example using CodiumAI PR Agent

Here's an example of package development, focusing only on the tools listed in the comparison table.

- `/review`
![review command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nqy63rjck5dn81757321.png)

- `/describe`
![describe command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7l45a1f9blbc4lzqie4u.png)

- `/improve`
![improve command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q8umvg8otkmzl0ru6ek8.png)

- `/ask "what is the biggest changes? what is the latest commit doing?"`
![ask command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cq0gz3xtajrjk5kos1ac.png)

I've tested all the commands of CodiumAI PR Agent except for **`/similar_issue`**. That's a total of **7 features**, which cost me **$0.86** for using the OpenAI API, and it takes me only **5** minutes to review **17** files. 

That’s a huge improvement.

## Conclusion

AI is revolutionizing individual performance across various fields. I currently use tools like ChatGPT, Bard, and claude.ai for scripting codes, solving math problems, and creating tests. These tools often generate an initial proof of concept (POC) or even a minimum viable product (MVP) in under a minute, significantly boosting my overall productivity.

I'm also exploring the use of PR agents in my work. So far, I find them suitable for open-source projects, and as AI technology advances, I anticipate their integration into enterprise environments in the near future.