Making WordPress.org

Changeset 6733


Ignore:
Timestamp:
02/24/2018 10:33:18 PM (7 years ago)
Author:
iandunn
Message:

WordCamp PHPCS: Add more exclusions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/phpcs.xml.dist

    r6711 r6733  
    2323        See these links for useful information:
    2424            - https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
     25            - https://github.com/squizlabs/PHP_CodeSniffer/wiki/Customisable-Sniff-Properties
    2526            - https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties
    2627    -->
     
    3031        <exclude-pattern>/build/*</exclude-pattern>
    3132
     33        disable WordPress.VIP.PostsPerPage.posts_per_page_posts_per_page for bin folder only
     34
    3235        Look through `General` and `Squiz` sniffs for anything you might want to add.
    3336            Is there one that detects `\Foo` instead of `use Foo`?
    3437            maximum nesting level?
    3538            function length?
     39            unnecessary order-of-operations params, e.g., $foo = ( $bar || $qax ) ? 'bax' : 'quix';
     40            echoing html instead of breaking php or using an external view. e.g., echo '<div>foo</div>'; should be `?> <div>foo</div> <?php` (but on multiple lines of course)
     41            var assignment immediately followed by if/while/for statement, without a blank space inbetween. maybe not in all cases, though?
     42            closing divs with a comment after them. it adds clutter. when viewing source, this is an artifact from the days before browser dev tools. view in IDEs, this isn't necessary if the code is properly formatted.
     43            return statement at end of function w/out blank line above it
     44            no space between last @param and the @return in docblock. i know diff than core, but whitespace makes it easier to scan/read. should also have space above first @param. sometimes want no space between different types of tags, though.
     45            opening/closing <?php ?> tags without a blank line after/before them, except when doing single-line like <?php foo(); ?>
     46            align ? and : in multiple ternary operator statements
     47            don't un-align params in function calls - e.g., multiple add_meta_box( $a, $b, $c, $d, $e, $f, $g ) calls should have the params aligned.
    3648
    3749        Maybe add WordCamp\Remote_CSS\output_cached_css to customEscapingFunctions or whichever param is most appropriate
     
    4153    -->
    4254
     55
    4356    <arg name="extensions" value="php" />
    4457
    4558    <!-- Show sniff codes in all reports -->
    46     <arg value="ps" />
     59    <arg value="ps"    />
    4760    <arg name="colors" />
    4861
     
    7386        <exclude name="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma" />
    7487        <exclude name="WordPress.WhiteSpace.OperatorSpacing.SpacingBefore" />
     88        <exclude name="WordPress.Arrays.ArrayDeclarationSpacing.SpaceBeforeArrayCloser" />
    7589        <exclude name="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket" />
    7690        <exclude name="Squiz.Strings.ConcatenationSpacing.PaddingFound" />
     91
     92        <!-- Warn about mis-aligned array items, but don't automatically "fix" them, because arrays in function calls get extra lines added.
     93             See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1305 -->
     94        <exclude phpcbf-only="true" name="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned" />
     95        <exclude phpcbf-only="true" name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" />
     96        <exclude phpcbf-only="true" name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" />
    7797    </rule>
    7898
     
    82102        <exclude name="Squiz.Commenting.FileComment.Missing" />
    83103        <exclude name="Squiz.Commenting.ClassComment.Missing" />
     104        <exclude name="Squiz.Commenting.FunctionComment.MissingParamTag" />
    84105        <exclude name="Generic.Commenting.DocComment.MissingShort" />
     106
     107        <!-- I don't see how these are useful. -->
     108        <exclude name="Squiz.Commenting.FileComment.MissingPackageTag" />
    85109
    86110        <!-- We really only use basic exceptions, so this is kind of overkill and tedious. -->
    87111        <exclude name="Squiz.Commenting.FunctionComment.EmptyThrows" />
     112
     113        <!-- Whitespace makes things more readable. -->
     114        <exclude name="Squiz.Commenting.FileComment.SpacingAfterOpen" />
     115
     116        <!-- It's not wrong for WordPress plugin file headers. -->
     117        <exclude name="Squiz.Commenting.FileComment.WrongStyle" />
    88118    </rule>
    89119
     
    95125        <exclude name="WordPress.VIP.RestrictedFunctions.file_get_contents_file_get_contents" />
    96126        <exclude name="WordPress.VIP.RestrictedFunctions.get_posts_get_posts" />
     127
     128        <!-- This is too strict. -->
     129        <exclude name="WordPress.VIP.SlowDBQuery.slow_db_query_meta_query" />
    97130    </rule>
    98131
Note: See TracChangeset for help on using the changeset viewer.