WordPress / WordPress/plugin-check

Proposal: Add Feature To Ignore Specific Checks Using Comments

Open
#1,154 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
362
Forks
126
Avg merge
1d 23h
Merged PRs (30d)
22

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository files, tests, or entry points are named. Start by tracing how Plugin Check reports errors and warnings, then compare the proposed PHP comment annotations with the existing results display; done means selected checks can be hidden while other findings remain visible.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.