Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal to modify the ruleset #1

Merged
merged 13 commits into from
Dec 15, 2021
187 changes: 187 additions & 0 deletions BigBite/ruleset.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="BigBite" namespace="BigBiteCS\BigBite" xsi:noNamespaceSchemaLocation="https://github.com/raw/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<config name="encoding" value="utf-8" />
<config name="testVersion" value="7.4-" />

<arg name="extensions" value="php" />
<arg name="parallel" value="75" />
<arg name="report" value="full" />
<arg name="report-width" value="150" />
<arg name="tab-width" value="4" />
<arg value="qs" />

<exclude-pattern>*/.git/*</exclude-pattern>
<!-- WordPress site directories/files. -->
<exclude-pattern>*/wp-activate.php</exclude-pattern>
<exclude-pattern>*/wp-blog-header.php</exclude-pattern>
<exclude-pattern>*/wp-comments-post.php</exclude-pattern>
<exclude-pattern>*/wp-config-sample.php</exclude-pattern>
<exclude-pattern>*/wp-config.php</exclude-pattern>
<exclude-pattern>*/wp-cron.php</exclude-pattern>
<exclude-pattern>*/wp-links-opml.php</exclude-pattern>
<exclude-pattern>*/wp-load.php</exclude-pattern>
<exclude-pattern>*/wp-login.php</exclude-pattern>
<exclude-pattern>*/wp-mail.php</exclude-pattern>
<exclude-pattern>*/wp-settings.php</exclude-pattern>
<exclude-pattern>*/wp-signup.php</exclude-pattern>
<exclude-pattern>*/wp-trackback.php</exclude-pattern>
<exclude-pattern>*/index.php</exclude-pattern>
<exclude-pattern>*/mu-plugins/*</exclude-pattern>
<exclude-pattern>*/private/*</exclude-pattern>
<exclude-pattern>*/upgrade/*</exclude-pattern>
<exclude-pattern>*/uploads/*</exclude-pattern>
<exclude-pattern>*/wp-admin/*</exclude-pattern>
<exclude-pattern>*/wp-content/advanced-cache.php</exclude-pattern>
<exclude-pattern>*/wp-content/db.php</exclude-pattern>
<exclude-pattern>*/wp-content/object-cache.php</exclude-pattern>
<exclude-pattern>*/wp-includes/*</exclude-pattern>
<exclude-pattern>xmlrpc.php</exclude-pattern>
<!-- Test directories. -->
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/cypress/*</exclude-pattern>
<!-- Package directories. -->
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<!-- Local files. -->
<exclude-pattern>*/vip-config/env-local-config.php</exclude-pattern>

<rule ref="WordPress">
<!-- Don't enforce long-form array syntax. -->
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" />
<!-- Don't enforce a file comment, since we enforce class, method, and function comments. -->
<exclude name="PEAR.Commenting.FileComment" />
<exclude name="Squiz.Commenting.FileComment" />
<!-- Allow tidier hooks that leverage anonymous functions. -->
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" />
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments" />
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" />
<!-- 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" />
<!-- Shorthand ternaries can be okay - should be checked at PR review time -->
<exclude name="WordPress.PHP.DisallowShortTernary.Found" />
<!-- Don't cause build failures out of spite -->
<exclude name="WordPress.WP.CapitalPDangit.Misspelled" />
</rule>

<rule ref="WordPress-VIP-Go">
<!-- Allow usage of static variables outside of classes -->
<exclude name="WordPressVIPMinimum.Variables.VariableAnalysis.StaticOutsideClass" />
</rule>

<!-- Ensure we're consistant with shorthand array syntax. -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
<!-- 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>
<!-- Warn when there's todo/fixme notations -->
<rule ref="Generic.Commenting.Todo" />
<rule ref="Generic.Commenting.Fixme" />
<!-- See: McCabes Cyclomatic Complexity -->
<rule ref="Generic.Metrics.CyclomaticComplexity" />
<!-- Limit nesting levels to 5. -->
<rule ref="Generic.Metrics.NestingLevel" />
<!-- Warn about delete/sizeof. -->
<rule ref="Generic.PHP.ForbiddenFunctions" />
<!-- Ensure no space after spread operator. -->
<rule ref="Generic.WhiteSpace.SpreadOperatorSpacingAfter" />

<!-- Disallow pearl-style comments (#) ... -->
<rule ref="PEAR.Commenting.InlineComment" />
<!-- Enforce wp-style spaces between parens. -->
<rule ref="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket" />
<rule ref="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket" />
<!-- Ensure default values are assigned in functions/methods. -->
<rule ref="PEAR.Functions.ValidDefaultValue" />
<!-- Ensure multi-line objects/method-chains are indented. -->
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent" />
<!-- Check that the closing braces of scopes are aligned correctly. -->
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace" />

<!-- Force debug output function calls to error. -->
<rule ref="Squiz.PHP.DiscouragedFunctions">
<properties>
<property name="error" value="true" />
</properties>
</rule>
<!-- Disallow nested functions (except within closures). -->
<rule ref="Squiz.PHP.InnerFunctions" />
<!-- Ensure inbuilt PHP functions are lowercase. -->
<rule ref="Squiz.PHP.LowercasePHPFunctions" />
<!-- Ensure class properties have scoping operators (public/protected/private). -->
<rule ref="Squiz.Scope.MemberVarScope" />
<!-- Ensure class methods have scoping operators. -->
<rule ref="Squiz.Scope.MethodScope" />
<!-- Don't allow usage of $this in static methods. -->
<rule ref="Squiz.Scope.StaticThisUsage" />
<!-- Prevent empty lines between function declaration and body. -->
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace" />
<!-- Normalise whitespace around logical operators. -->
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing" />
<!-- Normalise whitespace around class properties. -->
<rule ref="Squiz.WhiteSpace.MemberVarSpacing" />
<!-- Normalise whitespace around operators. -->
<rule ref="Squiz.WhiteSpace.OperatorSpacing" />
<!-- Normalise whitespace around class properties. -->
<rule ref="Squiz.WhiteSpace.PropertyLabelSpacing" />

<!-- Ensure files end in a newline -->
<rule ref="PSR2.Files.EndFileNewline" />
<!-- Ensure there are no "else if" statements (use "elseif"). -->
<rule ref="PSR2.ControlStructures.ElseIfDeclaration" />
<!-- Validate switch statements. -->
<rule ref="PSR2.ControlStructures.SwitchDeclaration" />
<!-- Prevent empty lines between method bodies and closing braces. -->
<rule ref="PSR2.Methods.FunctionClosingBrace" />
<!-- Ensure use statements are correct. -->
<rule ref="PSR2.Namespaces.UseDeclaration" />

<!-- Validate anonymous class declarations. -->
<rule ref="PSR12.Classes.AnonClassDeclaration" />
<!-- Ensure closing braces are the only content on a line. -->
<rule ref="PSR12.Classes.ClosingBrace" />
<!-- Ensure boolean operators are consistently placed. -->
<rule ref="PSR12.ControlStructures.BooleanOperatorPlacement" />
<!-- Validate declare statements. -->
<rule ref="PSR12.Files.DeclareStatement">
<!-- Don't error with spacing between parens or operators. -->
<exclude name="PSR12.Files.DeclareStatement.SpaceFoundAfterDirective" />
<exclude name="PSR12.Files.DeclareStatement.SpaceFoundAfterDirectiveValue" />
<exclude name="PSR12.Files.DeclareStatement.SpaceFoundBeforeDirective" />
<exclude name="PSR12.Files.DeclareStatement.SpaceFoundBeforeDirectiveValue" />
</rule>
<!-- Validate format of file headers (when present). -->
<rule ref="PSR12.Files.FileHeader">
<!-- Disable assumption that the first comment in a file is a file comment. -->
<exclude name="PSR12.Files.FileHeader.SpacingAfterBlock" />
</rule>
<!-- Validate import statements. -->
<rule ref="PSR12.Files.ImportStatement" />
<!-- Prevent short opening PHP tag. -->
<rule ref="PSR12.Files.OpenTag" />
<!-- Ensure no superfluous whitespace around nullable type hints. -->
<rule ref="PSR12.Functions.NullableTypeDeclaration" />
<!-- Validate return type hints. -->
<rule ref="PSR12.Functions.ReturnTypeDeclaration" />
<!-- Enforce shorthand type hints (int/bool, not integer/boolean). -->
<rule ref="PSR12.Keywords.ShortFormTypeKeywords" />
<!-- Prevent overly-enthusiastic use of compound namespaces. -->
<rule ref="PSR12.Namespaces.CompoundNamespaceDepth" />
<!-- Normalise whitespace surrounding operators. -->
<rule ref="PSR12.Operators.OperatorSpacing" />
<!-- Ensure class constants have scoping operators. -->
<rule ref="PSR12.Properties.ConstantVisibility" />
<!-- Validate use statements. -->
<rule ref="PSR12.Traits.UseDeclaration">
<!-- Allow a blank line before the first use statement within a class. -->
<exclude name="PSR12.Traits.UseDeclaration.UseAfterBrace" />
</rule>
</ruleset>
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
{
"name": "Paul Taylor",
"email": "paul@bigbite.net"
},
{
"name": "Jon McPartland",
"email": "jon@bigbite.net"
}
],
"scripts": {}
Expand Down
81 changes: 0 additions & 81 deletions ruleset.xml

This file was deleted.