Closed ntwb closed 5 years ago
Sorry for deleting all the issue template, but none of it was relevant to reporting a bug that is not a rule
No apology needed. Now the first version is close to release, we should probably add some additional issue templates.
For WPThemeReiew to work without the requirement to have WPCS or WPCS_DIR constants defined, of a .pathtowpcs file.
Absolutely. Thanks for finding and reporting this bug. PR #187 should fix this.
The use of the dealerdirect/phpcodesniffer-composer-installer registers and installs WPCS rulesset correctly and as such this registration should be used and not the above constants or dotfile.
Technically, this works slightly differently.
Yes, the Composer plugin registers the standards with PHPCS, however, PHPCS will only load any autoload
files provided by a standard if the whole standard is used.
As WPTRTCS only uses select sniffs from WPCS, not any of the complete rulesets, WPTRTCS needs to load the WPCS autoload file, which is where the bug was.
Absolutely. Thanks for finding and reporting this bug. PR #187 should fix this.
Thanks for the fix and quick turnaround @jrfnl 👍
Yes, the Composer plugin registers the standards with PHPCS, however, PHPCS will only load any autoload files provided by a standard if the whole standard is used.
Would including wp-coding-standards/wpcs
in composer.json
and adding <rule ref="WordPress-Core"/>
and <rule ref="WordPress-Docs"/>
in phpcs.xml.dist
workaround that as they are then explicitally called?
Would including wp-coding-standards/wpcs in composer.json and adding
and in phpcs.xml.dist workaround that as they are then explicitally called?
Changing the composer.json
file would make no difference as WPCS will be installed anyway as it is a dependency of TRTCS.
Adding any of the WPCS rulesets to the phpcs.xml.dist
would, as in that case, the ruleset is read out by PHPCS and PHPCS will load the autoload file based on that.
However, for TRTCS, that wouldn't be a solution as it shouldn't have an opinion on code style (which the WPCS rulesets do), so the PR I've pulled is a more permanent fix.
I had the same issue when I wanted to sniff the new twenty nineteen theme against this standard, but I thought that I did something wrong 😬
@dingo-d, same, I discovered it whilst trying to add it to twenty nineteen 👍
I'm just glad it was discovered before the 0.1 release. I tested with quite a few different setups and at some point must not have realized I hadn't tested yet with project based, duh..
Sorry for deleting all the issue template, but none of it was relevant to reporting a bug that is not a rule
Issue
A bug where using Composer to install the WPThemeReview package per install instructions fails:
Run using Composer script:
Running
phpcs
directly:To Reproduce
My relevent
composer.json
file contents:My
phpcs.xml.dist
file:Expected Behaviour
For WPThemeReiew to work without the requirement to have WPCS or WPCS_DIR constants defined, of a
.pathtowpcs
file.The use of the
dealerdirect/phpcodesniffer-composer-installer
registers and installs WPCS rulesset correctly and as such this registration should be used and not the above constants or dotfile.Actual Behaviour
Without manually pointing to the WPCS path WPThemeReview fails.
Environment
Composer version 1.7.2 2018-08-16 16:57:12