Using ChatGPT to Audit and Migrate Drupal Modules
This was fun! I just inherited a new Drupal 9 site. Whenever I get a new site I do a code review of all the custom modules for security purposes. Additionally, since I’ll eventually need to upgrade the site to Drupal 10, I figured I’d assess the code for D10 readiness. There were 16 custom modules.
As an experiment I fired up ChatGPT and used the following prompt:
CharGPT found 90% of the issues I would’ve flagged. The items it didn’t find that I didn’t find were stylistic, not things that I’d consider crucial or security related. Then I entered this simple prompt:
CharGPT updated the code. I received the code, ran it in stage and will implement it over the weekend in my next release window.
I find using ChatGPT instead of Drupal Rector for removing deprecations interesting because I can ask it questions and do an automated code audit, This probably saved me 80% of the time and is less prone to error and typos.