How to get code reviewed by ChatGPT directly in ServiceNow
Hey there!
Have you ever been stuck in the never-ending cycle of manual code review? It's like playing whack-a-mole, except the moles are bugs and the mallet is your brain. That's why I decided to create a code review tool in ServiceNow using the ChatGPT API. Not only did it save me from losing my mind, but it also showed off the integration opportunities between ChatGPT and ServiceNow.
So, I added a "Code to review" field to the SAFe Task form and a dropdown with options like "Comment inline", "Make leaner", "Find bugs", and "Explain". The options let the developer specify what type of feedback they want and how they want it delivered. Once the developer enters the code and selects the option, the code is sent to the ChatGPT API using a Flow.
The API then analyses the code and generates feedback, which is either stored directly in the code field or in the worknotes. Ta-da!
The best part? It saves time and reduces the risk of human error. It's like having a personal code review robot. Plus, it can help improve the quality of the code by giving suggestions for making the code leaner and more efficient.
In conclusion, I created this tool to show off the integration opportunities between ChatGPT and ServiceNow, and it's a valuable addition to any software development team looking to increase productivity and maintain high-quality code. And as a bonus, this article was entirely written by ChatGPT, I just added the pictures. So, if you're ever stuck in the code review cycle, remember that you're not alone and chatbot has your back!