23 lines
1.3 KiB
Markdown
23 lines
1.3 KiB
Markdown
|
---
|
||
|
title: Enforcing consistency with automation
|
||
|
date: 2024-09-23
|
||
|
permalink: daily/2024/09/23/enforce-consistency-with-automation
|
||
|
tags:
|
||
|
- software-development
|
||
|
cta: ~
|
||
|
snippet: |
|
||
|
Enforcing consistency with automation.
|
||
|
---
|
||
|
|
||
|
If you're trying to [keep your code consistent][0], such as following the same coding style or following conventions such as [find vs get][1] 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][2] 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.
|
||
|
|
||
|
[0]: {{site.url}}/daily/2024/09/20/be-consistent
|
||
|
[1]: {{site.url}}/daily/2024/09/05/find-vs-get
|
||
|
[2]: {{site.url}}/daily/2024/09/22/writing-custom-phpstan-rules-for-drupal-projects
|