-
-
Notifications
You must be signed in to change notification settings - Fork 479
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
WordPress.Files.FileName.InvalidClassFileName for tests/test-sample.php #882
Comments
I don't see the problem. The sniff follows the rule as prescribed by core. You can opt-out if you like: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#disregard-class-file-name-rules |
@jrfnl PHPUnit test files are meant to be named |
@danielbachhuber Ah! Now I see what you mean. |
Actually, this isn't a strict standard, but I think it's common enough that WPCS should accommodate it. |
@danielbachhuber You have a point - could you please test PR #883 to see if that eases the pain ? |
👍 WFM |
I've got no objection to the fix, but I'm not sure where you're getting the
|
@GaryJones FYI regarding the fix which has now been merged:
|
It comes from WP-CLI, the |
Right, but @danielbachhuber must have decided to use that himself, or otherwise seen it around even though it may never have been supported with a |
It predates me a while:
I think the pattern has been around long enough that it makes sense to support. |
So Core doesn't use it, and the only plugins (and themes) that use it are those that were scaffolded via wp-cli. While that's not an insignificant number, there's likely to be some, as many or more (really, I have no idea) who have unit tests files created by other means. The unique situation here though, is that most unit test files can be renamed without significant consequence, since PHPUnit is just looking in a specific directory for I'm fine with the exclusion such that files with test classes aren't named with the A secondary check (part of the Extra ruleset) that warns (with an option to turn off) about the test class files starting with |
Not necessarily. Here's 386k results in GitHub (unfortunately, not exact match): https://github.com/search?utf8=%E2%9C%93&q=%3Cdirectory+prefix%3D%22test-%22+suffix%3D%22.php%22%3E.%2Ftests%2F%3C%2Fdirectory%3E&type=Code |
Using a smaller more exact text string, and limiting the file extension brings that number down to 60k: There's no easy way to see if those results all apply to WordPress plugins/themes, and of course not all WP plugins / themes are on GitHub. Not all of those 60k projects will be using PHPCS. |
See https://travis-ci.org/wp-cli/sample-plugin/jobs/213413061
The text was updated successfully, but these errors were encountered: