简体   繁体   中英

Code sniffer, How to validate just clear PSR2?

my configuration:

phpcs --config-set default_standard PSR2

<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="test">
    <file>./../../web</file>

    <arg name="standard" value="PSR2"/>
    <arg name="extensions" value="php"/>
    <arg name="basepath" value="./../../"/>
    <arg name="tab-width" value="4"/>

    <rule ref="PSR2">
        <exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
        <exclude name="Generic.Files.LineLength.TooLong"/>
    </rule>

    <rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>

    <rule ref="Generic.WhiteSpace.ScopeIndent">
        <properties>
            <property name="indent" value="4"/>
            <property name="tabIndent" value="true"/>
        </properties>
    </rule>
</ruleset>

In report I have PSR1 , PSR2 , Generic and Squiz rules

How can I validate only clear PSR2 without Generic and Squiz ?

And second things: where can I found standard documentation for Generic and Squiz ?

Thx.

The PSR2 standard uses sniffs from other standards to enforce its rules. This is because there is a lot of overlap between standards and it doesn't make sense to duplicate the code. So the PSR2 standard pulls in checks from other standards to enforce similar rules.

When you tell PHP_CodeSniffer to check files using the PSR2 standard, you can be sure that it is only enforcing the PSR2 rules no matter what sniffs are being used to enforce it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM