| 1 |
<?xml version="1.0"?> |
| 2 |
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd"> |
| 3 |
<description>Coding Standards for Tests</description> |
| 4 |
|
| 5 |
<!-- Inspect files in the /tests folder --> |
| 6 |
<file>tests</file> |
| 7 |
|
| 8 |
<!-- Run in verbose mode and specify the precise rule that failed in output --> |
| 9 |
<arg value="sv"/> |
| 10 |
<arg name="colors"/> |
| 11 |
|
| 12 |
<!-- Check that code meets WordPress-Extra standards. --> |
| 13 |
<rule ref="WordPress-Extra"> |
| 14 |
<!-- Don't use yoda conditions --> |
| 15 |
<exclude name="WordPress.PHP.YodaConditions" /> |
| 16 |
|
| 17 |
<!-- File and variable naming conventions in Codeception differ from WordPress --> |
| 18 |
<exclude name="WordPress.NamingConventions" /> |
| 19 |
<exclude name="WordPress.Files.FileName" /> |
| 20 |
|
| 21 |
<!-- Class and function braces and spacing in Codeceptoin differs from WordPress --> |
| 22 |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterOpenParenthesis" /> |
| 23 |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.ExtraSpaceAfterCloseParenthesis" /> |
| 24 |
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen" /> |
| 25 |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeCloseParenthesis" /> |
| 26 |
<exclude name="Generic.Classes.OpeningBraceSameLine.BraceOnNewLine" /> |
| 27 |
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine" /> |
| 28 |
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceBeforeOpenBracket" /> |
| 29 |
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket" /> |
| 30 |
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket" /> |
| 31 |
|
| 32 |
<!-- _before() and _passed() must use underscores in Codeception --> |
| 33 |
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" /> |
| 34 |
|
| 35 |
<!-- Permit [] instead of array() --> |
| 36 |
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" /> |
| 37 |
|
| 38 |
<!-- We might use some datetime functions for tests --> |
| 39 |
<exclude name="WordPress.DateTime.RestrictedFunctions" /> |
| 40 |
|
| 41 |
<!-- Handles false positives where Coding Standards thinks we did something wrong when we're just checking for e.g. a stylesheet --> |
| 42 |
<exclude name="WordPress.WP.EnqueuedResources" /> |
| 43 |
<exclude name="WordPress.PHP.DiscouragedPHPFunctions" /> |
| 44 |
<exclude name="WordPress.WP.CapitalPDangit.Misspelled" /> |
| 45 |
</rule> |
| 46 |
|
| 47 |
<!-- Check that code is documented to WordPress Standards. --> |
| 48 |
<rule ref="WordPress-Docs"> |
| 49 |
<!-- File document level comments are useless for tests; we know what a test suite does --> |
| 50 |
<exclude name="Squiz.Commenting.FileComment.Missing" /> |
| 51 |
</rule> |
| 52 |
|
| 53 |
<!-- Add in some extra rules from other standards. --> |
| 54 |
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/> |
| 55 |
<rule ref="Generic.Commenting.Todo"/> |
| 56 |
</ruleset> |