Consider including rather that excluding Drupal sniffs
We are currently including all Drupal sniffs and then excluding the ones we don't like. The number of excludes is growing and growing. I wonder whether it makes sense to do it the other way round, i.e. just include the ones we want. This would works better with a fork the Drupal standard approach, which it sounds like we will likely take at some point.
This would allow us to stay on the latest version of the standard (we're currently on"drupal/coder": "~8.3.0"
) and still receive fixes to any of the sniff that we were opted into, but we won't automatically get opted into sniffs that make sense for Drupal but not us.
Basically, instead of one <rule ref="Drupal">
and lots of <exclude name="Drupal.Standard.ThatDontWorkForUs" />
, we would have lots of <rule ref="Drupal.Specific.Standards.ThatWeLike">
. This is similar to what Drupal does for its own standard, and this page https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset shows how you would do that.
We could also start including sniffs from other standards that we like, e.g. PSR-12 if we want to (admittedly, we could do this already today - just pointing out that this avenue is open to us).