Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 68 additions & 18 deletions BigBite/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,44 +49,47 @@
<!-- Built asset files from Build Tools. -->
<exclude-pattern>*/dist/*.asset.php</exclude-pattern>

<rule ref="WordPress">
<!-- Don't enforce long-form array syntax. -->
<!-- Use all of WP's ruleset, barring docs, and other rules that don't make sense for us. -->
<rule ref="WordPress-Extra">
<!-- Don't enforce long-form array syntax; we use short arrays exclusively. -->
<exclude name="Universal.Arrays.DisallowShortArraySyntax.Found" />
<!-- Don't enforce a file comment, since we enforce class, method, and function comments. -->
<exclude name="Squiz.Commenting.FileComment" />
<!-- Be slightly less aggressive about DocBlock formatting. -->
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop" />
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNoFullStop" />
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNotCapital" />
<!-- Don't enforce a period at the end of comments. -->
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
<!-- For consistency, allow a blank line before the class closing brace -->
<!-- For consistency, allow a blank line before the class closing brace. -->
<exclude name="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody" />
<!-- We have our own file name sniff - WP doesn't account for abstract classes -->
<!-- We have our own file name sniff - WP doesn't account for abstract classes. -->
<exclude name="WordPress.Files.FileName" />
<!-- Shorthand ternaries can be okay - should be checked at PR review time -->
<!-- Shorthand ternaries can be okay - should be checked at PR review time. -->
<exclude name="Universal.Operators.DisallowShortTernary.Found" />
<!-- Don't cause build failures out of spite -->
<!-- There are scenarios where this would cause issues. -->
<exclude name="WordPress.WP.CapitalPDangit.Misspelled" />
</rule>

<!-- Use all of WP VIP's ruleset. -->
<rule ref="WordPress-VIP-Go" />

<!-- Disallow closures longer than 5 (warn) or 8 (error) lines long -->
<!-- ################ -->
<!-- Additional rules -->
<!-- ################ -->

<!-- Disallow closures longer than 5 (warn) or 8 (error) lines long. -->
<rule ref="Universal.FunctionDeclarations.NoLongClosures" />
<!-- Enforce non-private, non-abstract methods in traits to be declared as final -->
<!-- Enforce non-private, non-abstract methods in traits to be declared as final. -->
<rule ref="Universal.FunctionDeclarations.RequireFinalMethodsInTraits" />
<!-- Enforce the use of the boolean && and || operators instead of the logical and/or operators -->
<!-- Enforce the use of the boolean && and || operators instead of the logical and/or operators. -->
<rule ref="Universal.Operators.DisallowLogicalAndOr" />

<!-- Warn about unused function parameters -->
<!-- Warn about unused function parameters. -->
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter">
<!-- Except under circumstances in which they make sense. -->
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed" />
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed" />
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceAfterLastUsed" />
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed" />
</rule>
<!-- Check block comments for conformity.. -->
<rule ref="Generic.Commenting.DocComment">
<!-- Allow other tags to come before @param comments - @see, @link, etc. -->
<exclude name="Generic.Commenting.DocComment.ParamNotFirst" />
</rule>
<!-- Warn when there's todo/fixme notations -->
<rule ref="Generic.Commenting.Todo" />
<rule ref="Generic.Commenting.Fixme" />
Expand All @@ -109,6 +112,53 @@
<!-- Check that the closing braces of scopes are aligned correctly. -->
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace" />

<!-- Check block comments for conformity. -->
<rule ref="Squiz.Commenting.BlockComment">
<!-- We do not like empty lines after block comments. -->
<exclude name="Squiz.Commenting.BlockComment.NoEmptyLineAfter" />
<!-- Allow for /* translators: ... */ comments. -->
<exclude name="Squiz.Commenting.BlockComment.SingleLine" />
<!-- These sniff codes use spaces for indentation. -->
<exclude name="Squiz.Commenting.BlockComment.FirstLineIndent" />
<exclude name="Squiz.Commenting.BlockComment.LineIndent" />
<exclude name="Squiz.Commenting.BlockComment.LastLineIndent" />
<!-- We expect block comments to start with /** (instead of /*). -->
<exclude name="Squiz.Commenting.BlockComment.WrongStart" />
</rule>
<!-- Check class comments for conformity. -->
<rule ref="Squiz.Commenting.ClassComment" />
<!-- Check block comment alignment. -->
<rule ref="Squiz.Commenting.DocCommentAlignment" />
<!-- Enforce explanatory comments for empty catch statements. -->
<rule ref="Squiz.Commenting.EmptyCatchComment" />
<!-- Check function comments for conformity. -->
<rule ref="Squiz.Commenting.FunctionComment">
<!-- We prefer shorthand int/bool over integer/boolean. -->
<exclude name="Squiz.Commenting.FunctionComment.IncorrectParamVarName" />
<exclude name="Squiz.Commenting.FunctionComment.InvalidReturn" />
<!-- Be slightly less aggressive about DocBlock formatting. -->
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop" />
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNoFullStop" />
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNotCapital" />
</rule>
<!-- Enforce comments for @throws tags. -->
<rule ref="Squiz.Commenting.FunctionCommentThrowTag" />
<!-- Check inline comments for conformity. -->
<rule ref="Squiz.Commenting.InlineComment">
<!-- Allow inline docblocks. -->
<exclude name="Squiz.Commenting.InlineComment.DocBlock" />
<!-- Don't enforce a period at the end of comments. -->
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
<!-- Allow "translators:" comments. -->
<exclude name="Squiz.Commenting.InlineComment.NotCapital" />
</rule>
<!-- Disallow post-statement comments. -->
<rule ref="Squiz.Commenting.PostStatementComment" />
<!-- Check variable comments for conformity. -->
<rule ref="Squiz.Commenting.VariableComment">
<!-- We prefer shorthand int/bool over integer/boolean. -->
<exclude name="Squiz.Commenting.VariableComment.IncorrectVarType" />
</rule>
<!-- Force debug output function calls to error. -->
<rule ref="Squiz.PHP.DiscouragedFunctions">
<properties>
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml.dist.sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Example Project" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Example Project" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd">
<description>This is an example project</description>

<exclude-pattern>/root/path/to/file.php</exclude-pattern>
Expand Down