Skip to content

Proposal: Add Feature To Ignore Specific Checks Using Comments #1154

@kofimokome

Description

@kofimokome

The plugin check plugin is a great tool. It has helped developers like me make their code compliant with the WordPress guidelines. However, some errors and warnings detected by this tool fall under the false positive category.

Similar toos like PHP Mess Detector and PHPStan have a way of supressing errors, using comments like

$test = new Test();

// @phpstan-ignore-next-line
$test->magic_property = 'magic value';

for PHPStan
or

/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function test( $a , $b, $c ) {
    ...
}

for PHP Mess Detector

Proposal

I would be great if there is a way to supress the errors and warnings the developer thinks are false positives from showing as these could sometimes overcrowd the results page, making it difficult to spot other errors. Supressing this errors will enable the developer to focus on solving the most pertinent issues as these errors will be hidden from the results page.

I am proposing adding a feature to hide some errors and warnings.
For example

public function check_nonce() {
    ...
}

/**
* @PluginCheckSuppress(WordPress.Security.NonceVerification.Recommended)
*/
function some_function_here() {
    // Already checked for the nonce in the check_nonce() function
    // codes here ...
}

Please let me know what you think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions