Skip to content

Latest commit

 

History

History
59 lines (42 loc) · 1.71 KB

File metadata and controls

59 lines (42 loc) · 1.71 KB

Disabling or Excluding Rules

Prefer ruleset-level exclusions over inline ignores. A rule disabled in phpcs.xml.dist is visible to reviewers and applies consistently across local development, CI, and IDE integrations.

Disable a Rule Globally

<rule ref="SymPress-Enterprise-Modern">
    <exclude name="SymPress.ControlStructures.DisallowElse.ElseFound" />
</rule>

Disable a Rule for a Path

<rule ref="SymPress.Functions.FunctionLength">
    <exclude-pattern>*/tests/*</exclude-pattern>
</rule>

Apply a Different Standard to a Path

Exclude the path from the general standard and include it in a narrower standard:

<rule ref="SymPress-Enterprise-Modern">
    <exclude-pattern>*/templates/*</exclude-pattern>
</rule>

<rule ref="SymPress-Templates">
    <include-pattern>*/templates/*</include-pattern>
</rule>

SymPress-Templates includes the WordPress security layer. Use it as the template-specific profile, not as a way to opt templates out of escaping, i18n, nonce, or validated-input checks.

Inline Exceptions

Use inline ignores only when the exception is intentionally tied to one small piece of code:

// phpcs:ignore SymPress.Functions.DisallowCallUserFunc.Found
call_user_func($callback);

Use a block-level ignore for generated or framework-required code that cannot be expressed cleanly in a ruleset:

// phpcs:disable SymPress.Functions.DisallowGlobalFunction.Found
function plugin_bootstrap(): void
{
    // WordPress entrypoint glue.
}
// phpcs:enable SymPress.Functions.DisallowGlobalFunction.Found

Keep inline suppressions as narrow as possible and include the full sniff code.

See Enterprise Adoption for the full false-positive policy.