Enforcing consistency with automation

If you're trying to keep your code consistent, such as following the same coding style or following conventions such as find vs get or design systems such as repositories or builder classes, instead of relying on manual code review and taking the time of a colleague, you can leverage automation to run checks for you.

You can run tools such as phpcs or eslint to enforce a coding style and use Git hooks or a CI pipeline to run them automatically or integrate them into your text editor or IDE so you can see and resolve issues as the code is being written.

You can use static analysis tools such as PHPStan to find potential bugs but also enforce conventions by writing custom rules for your project or using architectural testing tools such as PHPat.

By automating checks, you'll have a consistent result every time and don't need to wait for someone else to find small issues you could have fixed quickly.

- Oliver

Was this interesting?

Sign up here and get more like this delivered straight to your inbox every day.

About me

Picture of Oliver

I'm an Acquia-certified Drupal Triple Expert with 17 years of experience, an open-source software maintainer and Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.