Skip to content

Conversation

jaymcp
Copy link
Member

@jaymcp jaymcp commented Mar 7, 2025

Fixes #167

The WordPress-Docs ruleset implements Sniffs that conform to WordPress' documentation standards. However, that ruleset does not conform completely to our coding standards, and it is difficult to override external Sniff customisations in external standards.

So, this PR removes that standard from our ruleset, and implements a set of rules that better conform with our coding standards. The rules remain heavily inspired by WordPress-Docs.

This PR also tidies up some of the comments in our ruleset.

This PR can be tested by running the following in terminal:

composer require --dev bigbite/phpcs-config:dev-feat/docs-sniffs

followed by

./vendor/bin/phpcs .

jaymcp added 3 commits March 7, 2025 13:34
The WordPress-Docs ruleset that we were using
excludes several sniff codes that are useful
to us. So, this change removes that ruleset
and adds back many of the sniffs it includes,
but with adjustments that better suit the
needs of Big Bite.
@jaymcp
Copy link
Member Author

jaymcp commented Mar 7, 2025

@g-elwell wanted to make you aware of this incoming PR. I've tried it out on your the project you're working on, and it does seem to better catch the docblock non-conformities. It's not perfect, but I do think it'll be more comprehensive than our existing standard.
It would require a couple of ignore/disable comments (for @phpstan-type and hinting for those type declarations), but I don't think it'll be too frustrating. I'll DM you a diff of the changes I made based upon this PR as it stands. Please let me know if there's anything glaring that you disagree with, or perhaps that it misses.

@jaymcp jaymcp marked this pull request as ready for review March 10, 2025 09:52
@jaymcp jaymcp requested a review from a team March 10, 2025 09:52
@g-elwell
Copy link
Member

@g-elwell wanted to make you aware of this incoming PR. I've tried it out on your the project you're working on, and it does seem to better catch the docblock non-conformities. It's not perfect, but I do think it'll be more comprehensive than our existing standard. It would require a couple of ignore/disable comments (for @phpstan-type and hinting for those type declarations), but I don't think it'll be too frustrating. I'll DM you a diff of the changes I made based upon this PR as it stands. Please let me know if there's anything glaring that you disagree with, or perhaps that it misses.

Thanks for the heads up! I think the additions are great, and wouldn't be too often I'd need to disable/ignore. The @phpstan-type usage is still a bit of an experiment at this stage, so wouldn't want to make any allowances here for it, so this is all good as as I'm concerned

@g-elwell g-elwell self-requested a review March 10, 2025 10:14
@g-elwell g-elwell requested a review from a team March 10, 2025 10:14
@jaymcp jaymcp merged commit 231d9bd into main Mar 10, 2025
5 checks passed
@jaymcp jaymcp deleted the feat/docs-sniffs branch March 10, 2025 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce sniffs for docblocks

2 participants