-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHPCS: Include the test
directory
#48754
base: trunk
Are you sure you want to change the base?
Conversation
Flaky tests detected in 2a02183. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11517256362
|
@anton-vlasenko and @hellofromtonya, you worked on similar tasks so you might want to have a look. It looks like a step in the right direction to me. |
@gziolo I don't mind including the tests directory. My only concern is that the PHPUnit tests in Gutenberg should be checked against the same rules as those in Core. |
Update: I have discovered that the This will ensure that when |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
What?
This PR adds the root-level test directory as a check target for PHPCS. At the same time, I added theme-specific rules and fix lint errors.
Why?
Since the test directory already contains PHP files, I think it would make sense to include them.
How?
The existing PHPCS rule causes the following error in the PHP files that the theme has:
Squiz.Commenting.FunctionComment.Missing
: Missing doc comment for function xxxxx()Squiz.Commenting.FileComment.Missing
: Missing file doc commentSquiz.Commenting.FileComment.WrongStyle
: You must use "/**" style comments for a file commentThese rules are also excluded in the Theme Check plugin, so I excluded these rules as well. Then I fixed the remaining errors.
Testing Instructions
In PHP files under the test directory, make changes that do not follow the rules. For example, remove the space after the opening parenthesis.
Run
npm run lint:php
and confirm that a Lint error occurs.