Skip to content

Adding WordPress-VIP-Go ruleset suppresses many warnings #441

@paulschreiber

Description

@paulschreiber

Bug Description

Adding the WordPress-VIP-Go ruleset suppresses many warning from WordPress-Core, including StrictComparisons.LooseComparison.

Sample file (test.php)

<?php
if ( 'edit.php' == $pagenow ) {
	echo 'yes';
}

Example ruleset:

<?xml version="1.0"?>
<ruleset name="Custom ruleset">
    <rule ref="WordPress-Extra"/>
    <rule ref="WordPress-VIP-Go" />
</ruleset>

Output:

$ vendor/bin/phpcs test.php 
W 1 / 1 (100%)

Example ruleset:

<?xml version="1.0"?>
<ruleset name="Custom ruleset">
    <rule ref="WordPress-Extra"/>
</ruleset>

Output:

$ vendor/bin/phpcs test.php 
W 1 / 1 (100%)

FILE: test.php
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
 2 | WARNING | Found: ==. Use strict comparisons (=== or !==).
   |         | (WordPress.PHP.StrictComparisons.LooseComparison)
-----------------------------------------------------------------------------------------------------------------

Time: 268ms; Memory: 8MB

Environment

Question Answer
PHP version 7.3.3
PHP_CodeSniffer version 3.4.2
VIPCS version 2.0.0

Additional Context (optional)

The problem seems to be this commit: b8c5b76

Setting <severity> to 3 results in no output. Setting it to 5 results in the expected output.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions