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

Implement new rules for further conformity checking #169

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
composer.phar
.vscode/
.phpunit.result.cache
Expand Down
28 changes: 26 additions & 2 deletions BigBite/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@
<rule ref="WordPress-Extra">
<!-- Don't enforce long-form array syntax; we use short arrays exclusively. -->
<exclude name="Universal.Arrays.DisallowShortArraySyntax.Found" />
<!-- Shorthand ternaries can be okay - should be checked at PR review time. -->
<exclude name="Universal.Operators.DisallowShortTernary.Found" />
<!-- For consistency, allow a blank line before the class closing brace. -->
<exclude name="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody" />
<!-- We prefer +=/-= over ++/\-\-. -->
<exclude name="Squiz.Operators.IncrementDecrementUsage" />
<!-- 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. -->
<exclude name="Universal.Operators.DisallowShortTernary.Found" />
<!-- There are scenarios where this would cause issues. -->
<exclude name="WordPress.WP.CapitalPDangit.Misspelled" />
</rule>
Expand Down Expand Up @@ -221,4 +223,26 @@
<!-- Allow a blank line before the first use statement within a class. -->
<exclude name="PSR12.Traits.UseDeclaration.UseAfterBrace" />
</rule>
<!-- Use statements must be listed A-Z. -->
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses" />
<!-- Disallow use of grouping ({}) in use statements. -->
<rule ref="SlevomatCodingStandard.Namespaces.DisallowGroupUse" />
<!-- Disallow unused use statements. -->
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses" />
<!-- Disallow loose equality operators. -->
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators" />
<!-- Prefer +=/-= over ++/\-\-. -->
<rule ref="SlevomatCodingStandard.Operators.DisallowIncrementAndDecrementOperators" />
<!-- Prefer generic over array style for type hints (e.g. array<int> over int[]). -->
<rule ref="SlevomatCodingStandard.TypeHints.DisallowArrayTypeHintSyntax" />
<!-- Prefer shorthand scalar type hints in docblocks. -->
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints" />
<!-- Check that type hints are nullable when default value is null. -->
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue" />
<!-- Disallow variable variables ($$foo). -->
<rule ref="SlevomatCodingStandard.Variables.DisallowVariableVariable" />
<!-- Disallow unused variables. -->
<rule ref="SlevomatCodingStandard.Variables.UnusedVariable" />
<!-- Disallow useless variables. -->
<rule ref="SlevomatCodingStandard.Variables.UselessVariable" />
</ruleset>
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"automattic/vipwpcs": "^3.0",
"php": ">=7.2",
"phpcsstandards/phpcsutils": "^1.0.8",
"phpcsstandards/phpcsextra": "^1.1"
"phpcsstandards/phpcsextra": "^1.1",
"slevomat/coding-standard": "^8.16"
},
"require-dev": {
"phpcsstandards/phpcsdevtools": "^1.1.0",
Expand Down
114 changes: 113 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.