How do I make use of ChatGPT to review my code

Sam Ho
4 min readApr 2, 2023

As a software engineer, I know that I should check my code before commit. But I don’t like code review. It is a tedious and time-consuming process. Not to mention the project deadline is approaching.

And then I was thinking, ChatGPT is out there, helping human on tedious work. Hmm, maybe it can help me?

I decided to make use of ChatGPT for my code review, and I have found it to be quite helpful.

Image from Pexels.com

My problem on Code Review

  1. Time: Code review can be a time-consuming process, particularly for large or complex commit.
  2. Lack of Reviewer: A good reviewer need to have a deep understanding of the frameworks and libraries being used, as well as the context and requirements of the project, wich is difficult to find. Moreover, it is not possible to find a review when I am working on a solo project.
  3. Subjectivity: It can be difficult to ensure human reviewers do not have bias on the codebase.

How ChatGPT can help

I integrated ChatGPT with git hook, in a way that when I run:

--

--

Sam Ho

London-based frontend engineer. Share knowledge on web development.