DEV Community

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

Posted on • Edited 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 (8)

Collapse
 
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?

Right?

Collapse
 
codewithbernard profile image
Bernard Bado

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

Collapse
 
davidfromultrix profile image
DavidFromUltrix

You do sound boomer.

Collapse
 
fyodorio profile image
Fyodor

I hear this lies each day man…

Collapse
 
russquan profile image
YuQuan

Amazing work! This would be go viral man!!

Collapse
 
codewithbernard profile image
Bernard Bado

Let's hope so

Collapse
 
codewithbernard profile image
Bernard Bado

There is a limit, yes!

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

Collapse
 
theluk profile image
Lukas Klinzing

Checkout langchain

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