DEV Community

Cover image for ChatGPT Is Helping Me Do Code Reviews
Bernard Bado
Bernard Bado

Posted on • Updated on


ChatGPT Is Helping Me Do Code Reviews

Update: Since the release of this post, I built the exact tool that I'm describing in this post. If you wish to try it out, you can do so by creating account on the official site. And now, back to the original post.

I have a confession to make.

I'm not a big fan of doing code review. Especially not those big ones.

But lately, I've had a great idea. The idea was to ask GPT model for help.

And I can proudly say, the help I received.

Pull GPT helping me with code reviews

My Problem With Code Reviews

What I really hate about code reviews is looking at a completely new file with undocumented code.

I have no idea what is going on there.

And this is exactly where GPT model comes into play.

Pull GPT overview

I built a simple Github bot that do the following:

  • Analyze new pull requests
  • Process newly added files
  • Write brief description of the code
  • Add description as a comment to pull request

I tested this whole flow on one of my projects, and I was very satisfied with the result.

Pull GPT in action

Here's a brief description that the model wrote.

This code is a React functional component that renders an affiliate ad using a combination of React hooks and DOM manipulation.

The component uses the useAffiliateAssets hook to fetch assets for the ad, useMediaQuery to determine the device type, then it renders the ad using ReactDOM.createPortal and inserting the ad before the heading variable in the HTML document.

If any of the required assets, heading, mediumBox or mediumLandscape are not available the component returns null

My (Possible) Next Steps

I just built the prototype together to prove that the concept is working.

But I can't help to wonder.

  • Is this something that could help the others?
  • Should I build this into a fully-featured product?

I know this would be a really fun project to work on, but I'm not sure if the idea is valid.

If you think it is, please let me know in the comments. If you think it's not, let me know as well.

Top comments (9)

fyodorio profile image
Fyodor • Edited

Potential disputes with such a bot look like a dead end venture... And the point of review is the collaboration process. In opposite case it's easier to just delegate coding to chatGPT. And I may sound boomer but who'll trust it... right?


codewithbernard profile image
Bernard Bado

The purpose is not to do the review. But to help reviewers give them overview of the changes

davidfromultrix profile image

You do sound boomer.

fyodorio profile image

I hear this lies each day man…

t0nyba11 profile image
Tony B

How did you get the GPT AI to work on "big commits" ... I thought there was a text limit on the inputs?

codewithbernard profile image
Bernard Bado

There is a limit, yes!

At least I'm encouraging not to write big files :)

theluk profile image
Lukas Klinzing

Checkout langchain

russquan profile image

Amazing work! This would be go viral man!!

codewithbernard profile image
Bernard Bado

Let's hope so

Some comments may only be visible to logged-in visitors. Sign in to view all comments.

The AI Brief

AI generated git commit messages

Minimize the struggle of remembering what you just coded. AI-generated commits make it easier to manage projects and keep track of changes. The Nutlope/aicommits project demonstrates how AI can improve commit messages.

I open sourced an AI that creates any UI in seconds

Make AI-generated user interfaces a breeze. This open-source project harnesses the power of generative AI technologies like chatGPT to create versatile, quick, and intuitive UI components.

Use AI to commit like a PRO in 1 second

Upgrade your commit message game with AI. Boost your productivity by using ChatGPT to generate commit messages and avoid context switching. OpenCommit is an open-source library that helps you achieve this easily.

Build your own ChatGPT starter kit

Train AI models on custom data for improved domain-specific knowledge. Combine the power of WebView technologies and this starter kit to train your ChatGPT model on specific websites, allowing for better-optimized outcomes.