Automattic / VIP-Coding-Standards

PHP_CodeSniffer ruleset to enforce WordPress VIP coding standards.
https://wpvip.com/documentation/how-to-install-php-code-sniffer-for-wordpress-com-vip/
Other
236 stars 40 forks source link

WPCS 3.0: Fix ruleset tests #736

Closed GaryJones closed 1 year ago

GaryJones commented 1 year ago

Once #734 has been merged, this can be rebased to just show the ruleset tests changes.


Ruleset tests: update for WPCS 3.0

The ruleset tests were failing mainly due to the renaming of some violation codes that we were excluding.

The other change to account for was the replacement of a WPCS StrictComparisons sniff with a PHPCSExtras Universal sniff. The sniff in PHPCSExtra contains a fixer. As this is a risky fixer, this fixer is turned off for WPCS. The sniff in PHPCSExtra will provide metrics about loose versus strict comparisons.

Ruleset tests: Add label before test runs

Make it clear which ruleset being tested, even on a test failure.

Enable ruleset tests

Now the issues have been address, these can be enabled again in composer check-all and a Github workflow.

GaryJones commented 1 year ago

Closing for now, as #746 handled the fixing of ruleset tests (and other bits) for PHP 8.1 while continuing to use WPCS 2.3.0.

Some of the changes (with feedback) in this PR will be pulled into a branch that uses WPCS 3.0.