ChatGPT Is Helping Me Do Code Reviews

Bernard Bado - Jan 11 '23 - - Dev Community

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.

. . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player