Code review with AI
One of the most important jobs of a software engineer is to review the code of other engineers. This is typically done at modern companies to ensure code quality and can be as important and demanding as writing the code itself.
Typically, one or more engineers, often someone more senior, may review your code and make comments to improve the code further, and add more tests, or “nits,” which can be just small format improvements. You will be expected to address these comments before the code is ready.
Here is an example of a typical pull request in GitHub, where someone has requested additional changes to the code:
Figure 3.9 – An example of the code review process in GitHub
In this recipe, we will use AI to help us simulate a typical code review process and get a feel for how we would use it to improve our code further.
How to do it...
Here are the steps to try this recipe:
- Let’s use ChatGPT...