WordPress / WordPress-Coding-Standards

PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions
MIT License
2.56k stars 487 forks source link

Sniffing with MissingPackageTag even if excluded #1148

Closed mikaelz closed 7 years ago

mikaelz commented 7 years ago

When testing with phpcs -s --standard=phpcs.xml test.php

I get Missing @package tag in file comment (Squiz.Commenting.FileComment.MissingPackageTag)

But phpcs -s --standard=phpcs.xml test.php -e | grep -i MissingPackageTag doesn't output matches.

Where on earth does it get it? In WordPress-Docs ruleset it's excluded.

PHP_CodeSniffer version 3.0.2 WPCS at master in ~/github/wpcs My phpcs.xml

<?xml version="1.0"?>
<ruleset name="WordPress Project">
    <description>A custom set of rules to check for a WPized WordPress project</description>

        <config name="installed_paths" value="~/github/wpcs"/>

    <!-- Exclude WP Core folders and files from being checked. -->
    <exclude-pattern>/docroot/wp-admin/*</exclude-pattern>
    <exclude-pattern>/docroot/wp-includes/*</exclude-pattern>
    <exclude-pattern>/docroot/wp-*.php</exclude-pattern>
    <exclude-pattern>/docroot/index.php</exclude-pattern>
    <exclude-pattern>/docroot/xmlrpc.php</exclude-pattern>
    <exclude-pattern>/docroot/wp-content/plugins/*</exclude-pattern>

    <!-- Exclude the Composer Vendor directory. -->
    <exclude-pattern>/vendor/*</exclude-pattern>

    <!-- Exclude the Node Modules directory. -->
    <exclude-pattern>/node_modules/*</exclude-pattern>

    <!-- Exclude minified Javascript files. -->
    <exclude-pattern>*.min.js</exclude-pattern>

    <!-- Include the WordPress-Extra standard. -->
    <rule ref="WordPress-Extra">
        <exclude name="WordPress.XSS.EscapeOutput"/>
    </rule>

    <!-- Let's also check that everything is properly documented. -->
    <rule ref="WordPress-Docs"/>

    <!-- Add in some extra rules from other standards. -->
    <rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
    <rule ref="Generic.Commenting.Todo"/>

    <rule ref="WordPress.WP.DeprecatedClasses">
        <properties>
            <property name="minimum_supported_version" value="4.5"/>
        </properties>
    </rule>

    <rule ref="WordPress.WP.DeprecatedFunctions">
        <properties>
            <property name="minimum_supported_version" value="4.5"/>
        </properties>
    </rule>

    <rule ref="WordPress.WP.DeprecatedParameters">
        <properties>
            <property name="minimum_supported_version" value="4.5"/>
        </properties>
    </rule>
</ruleset>
mikaelz commented 7 years ago

Oh my bad, didn't read carefully. @package is required https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/51884433afd5039e0839ba5559ac2f0d26301076/WordPress-Docs/ruleset.xml#L24-L25