98 lines
4.8 KiB
XML
98 lines
4.8 KiB
XML
<?xml version="1.0"?>
|
|
<ruleset name="PHPCS Config">
|
|
<!--
|
|
See also:
|
|
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
|
|
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage
|
|
-->
|
|
<description>PHP coding standards configuration.</description>
|
|
|
|
<!-- Command line args, compare to: /vendor/bin/phpcs -(v)s -extensions=php -colors -->
|
|
<arg value="s"/> <!-- Show sniffs report. -->
|
|
<arg name="colors"/> <!-- Use colors in reports. -->
|
|
<arg name="extensions" value="php,dist" /> <!-- Sniff these file types. -->
|
|
|
|
<!--
|
|
============================================================================
|
|
PSR-2 ruleset:
|
|
https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/PSR2/ruleset.xml
|
|
-->
|
|
<rule ref="PSR2">
|
|
<exclude name="PSR2.Methods.FunctionCallSignature.SpaceAfterOpenBracket" />
|
|
<exclude name="PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket" />
|
|
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen" />
|
|
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose" />
|
|
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
|
|
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
|
|
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine" />
|
|
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
|
|
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
|
|
<exclude name="Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterOpen" />
|
|
<exclude name="Squiz.ControlStructures.ForLoopDeclaration.SpacingBeforeClose" />
|
|
<exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />
|
|
<exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose" />
|
|
<exclude name="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma" />
|
|
<exclude name="Squiz.Strings.ConcatenationSpacing.PaddingFound" />
|
|
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceBeforeEquals" />
|
|
<exclude name="PSR2.Namespaces.UseDeclaration.MultipleDeclarations" />
|
|
<exclude name="Squiz.PHP.DisallowMultipleAssignments" />
|
|
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
|
|
</rule>
|
|
|
|
<rule ref="PSR2.ControlStructures.ControlStructureSpacing">
|
|
<properties>
|
|
<property name="requiredSpacesAfterOpen" value="1" />
|
|
<property name="requiredSpacesBeforeClose" value="1" />
|
|
</properties>
|
|
</rule>
|
|
|
|
<!--
|
|
============================================================================
|
|
WordPress rulesets:
|
|
WordPress-Extra: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress-Extra/ruleset.xml
|
|
WordPress-VIP: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress-VIP/ruleset.xml
|
|
https://vip.wordpress.com/documentation/code-review-what-we-look-for
|
|
-->
|
|
<rule ref="WordPress-Extra">
|
|
<!-- Allow spaces -->
|
|
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
|
|
<exclude name="WordPress.VIP.SuperGlobalInputUsage.AccessDetected" />
|
|
<exclude name="WordPress.WhiteSpace.OperatorSpacing" />
|
|
</rule>
|
|
|
|
<rule ref="WordPress-VIP" />
|
|
|
|
<!--
|
|
============================================================================
|
|
Documentation rulesets:
|
|
WordPress-Docs: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress-Docs/ruleset.xml
|
|
https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/
|
|
Generic Commenting: https://github.com/squizlabs/PHP_CodeSniffer/tree/master/src/Standards/Generic/Sniffs/Commenting
|
|
-->
|
|
<rule ref="WordPress-Docs">
|
|
<!-- Do not enforce having a file comment for each file. -->
|
|
<exclude name="Squiz.Commenting.FileComment" />
|
|
<!-- Don't require full stop in comments. -->
|
|
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
|
|
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop" />
|
|
<!-- Don't require comment capitalization. -->
|
|
<exclude name="Generic.Commenting.DocComment.LongNotCapital" />
|
|
</rule>
|
|
|
|
<rule ref="Generic.Commenting">
|
|
<exclude name="Generic.Commenting.DocComment.MissingShort" />
|
|
<exclude name="Generic.Commenting.Fixme" />
|
|
<exclude name="Generic.Commenting.Todo" />
|
|
</rule>
|
|
|
|
<!--
|
|
============================================================================
|
|
Special or one-off rules.
|
|
-->
|
|
|
|
<!-- Normalize all require/require_onces to use statement, not function, syntax. -->
|
|
<rule ref="PEAR.Files.IncludingFile.BracketsNotRequired" />
|
|
|
|
<!-- Require short array syntax -->
|
|
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
|
|
</ruleset> |