Skip to content

No silencing possible if your custom standard directory name contains underscores #745

@MarcelloPerathoner

Description

@MarcelloPerathoner

If you put your custom standard in a directory called eg. php_coding_standard (which comes naturally because you probably already have node_modules and bower_components) you get silly sniff codes in your report (like php.standard.S.BraceOnSameLine in my case) which you cannot silence with

<rule ref="php.standard.S.BraceOnSameLine">
 <severity>0</severity>
</rule>

see stack trace below.

If I name the directory "phpcs" all is well.

This restriction should at least be documented.

Warning: PHP Fatal error: Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Referenced sniff "php.standard.S.BraceOnSameLine" does not exist' in /usr/share/php/PHP/CodeSniffer.php:1092
Stack trace:

0 /usr/share/php/PHP/CodeSniffer.php(733): PHP_CodeSniffer->_expandRulesetReference(Object(SimpleXMLElement), '/home/...', 0)

1 /usr/share/php/PHP/CodeSniffer.php(551): PHP_CodeSniffer->processRuleset('/home/...')

2 /usr/share/php/PHP/CodeSniffer/CLI.php(818): PHP_CodeSniffer->initStandard(Array, Array)

3 /usr/share/php/PHP/CodeSniffer/CLI.php(95): PHP_CodeSniffer_CLI->process()

4 /usr/bin/phpcs(25): PHP_CodeSniffer_CLI->runphpcs()

5 {main}

thrown in /usr/share/php/PHP/CodeSniffer.php on line 1092

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