문제

using codesniffer with pear standard. I got over 20tsd errors cause of line indents. I use tab-stops for indenting. I try to disable that check but I failed.

I removed the last rule from the generic standards in the ruleset.xml for the pear standard. Yet the indenting is still considered an error.

How do I remove the indention checks completely for the pear standard?

도움이 되었습니까?

해결책

You can achieve this by searching for the following file "ScopeIndentSniff.php" this must be in a folder called "WhiteSpace" under "standards". Just rename it. Be aware that applications may have their own folder with standards. Eclipse for example has an own folder where standards rest. So if you edit your share folder this might not apply. But you can setup Eclipse to use your share folder too. (Preferences -> PHP Tools -> CodeSniffer -> CodeSniffer Standards)

다른 팁

It should work, so you should definitely try to understand why tweaking your ruleset.xml file doesn't work in your environment, otherwise you'll be missing many features from CodeSniffer.

As a reminder, here are the two options:

  1. Either you explicitly exclude the sniff in your ruleset :

    <rule ref="PEAR">
        <exclude name="PEAR.WhiteSpace.ScopeIndent" />
    </rule>
    
  2. Or you mute down a specific error message, resulting in the rule actually being executed for potential other error messages :

    <rule ref="PEAR.WhiteSpace.ScopeIndent.Incorrect">
        <severity>0</severity>
    </rule>
    
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top