Search code examples
phpcodesniffer

How can i remove the missing subpackage error in a phpcs ruleset?


I want to remove this because i dont need it on my project.

 <rule ref="Squiz.Commenting.FileComment">
    <properties>
        <property name="subpackage" value="false"/>
    </properties>
 </rule>

See you


Solution

  • The way to exclude that specific error message in your ruleset.xml file is to use:

    <exclude name="Squiz.Commenting.FileComment.MissingSubpackageTag" />
    

    Use the -s command line argument to determine the code for a specific error message. You'll see something like this:

    Missing @subpackage tag in file comment
    (Squiz.Commenting.FileComment.MissingSubpackageTag)
    

    If you want to exclude the whole sniff, you'd instead use:

    <exclude name="Squiz.Commenting.FileComment" />
    

    There are a lot of other things you can do in a ruleset file. See the docs for more examples: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml