| 1 |
<?xml version="1.0"?> |
| 2 |
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WordPress Coding Standards" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd"> |
| 3 |
|
| 4 |
<description>The Coding standard for the WordPress Coding Standards itself.</description> |
| 5 |
<!-- |
| 6 |
############################################################################# |
| 7 |
COMMAND LINE ARGUMENTS |
| 8 |
https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Annotated-Ruleset |
| 9 |
############################################################################# |
| 10 |
--> |
| 11 |
|
| 12 |
<file>.</file> |
| 13 |
|
| 14 |
<!-- Exclude Composer vendor directory. --> |
| 15 |
<exclude-pattern>*/vendor/*</exclude-pattern> |
| 16 |
|
| 17 |
<!-- Only check PHP files. --> |
| 18 |
<arg name="extensions" value="php"/> |
| 19 |
|
| 20 |
<!-- Show progress, show the error codes for each message (source). --> |
| 21 |
<arg value="ps"/> |
| 22 |
|
| 23 |
<!-- Strip the filepaths down to the relevant bit. --> |
| 24 |
<arg name="basepath" value="."/> |
| 25 |
|
| 26 |
<!-- Check up to 8 files simultaneously. --> |
| 27 |
<arg name="parallel" value="8"/> |
| 28 |
|
| 29 |
<arg name="tab-width" value="0"/> <!-- Prevents PHPCS from enforcing tab width --> |
| 30 |
|
| 31 |
<!-- Exclude specific rule that enforces tabs --> |
| 32 |
<rule ref="Generic.WhiteSpace.ScopeIndent"> |
| 33 |
<properties> |
| 34 |
<property name="ignoreIndentationTokens" type="array"> |
| 35 |
<element value="T_COMMENT"/> |
| 36 |
<element value="T_DOC_COMMENT_OPEN_TAG"/> |
| 37 |
</property> |
| 38 |
</properties> |
| 39 |
</rule> |
| 40 |
|
| 41 |
<!-- Disable tab enforcement --> |
| 42 |
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent"/> |
| 43 |
|
| 44 |
<rule ref="WordPress"> |
| 45 |
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent"/> <!-- Fully exclude tab enforcement --> |
| 46 |
</rule> |
| 47 |
|
| 48 |
<!-- |
| 49 |
############################################################################# |
| 50 |
SET UP THE RULESETS |
| 51 |
############################################################################# |
| 52 |
--> |
| 53 |
|
| 54 |
<rule ref="WordPress"> |
| 55 |
<!-- This project needs to comply with naming standards from PHPCS, not WP. --> |
| 56 |
<exclude name="WordPress.Files.FileName"/> |
| 57 |
<exclude name="WordPress.NamingConventions.ValidVariableName"/> |
| 58 |
|
| 59 |
<!-- While conditions with assignments are a typical way to walk the token stream. --> |
| 60 |
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition"/> |
| 61 |
|
| 62 |
<!-- The code in this project is run in the context of PHPCS, not WP. --> |
| 63 |
<exclude name="WordPress.DateTime"/> |
| 64 |
<exclude name="WordPress.DB"/> |
| 65 |
<exclude name="WordPress.Security"/> |
| 66 |
<exclude name="WordPress.WP"/> |
| 67 |
|
| 68 |
<!-- Linting is done in a separate CI job, no need to duplicate it. --> |
| 69 |
<exclude name="Generic.PHP.Syntax"/> |
| 70 |
</rule> |
| 71 |
|
| 72 |
<!-- |
| 73 |
############################################################################# |
| 74 |
SNIFF SPECIFIC CONFIGURATION |
| 75 |
############################################################################# |
| 76 |
--> |
| 77 |
|
| 78 |
<rule ref="WordPress.Arrays.MultipleStatementAlignment"> |
| 79 |
<properties> |
| 80 |
<property name="alignMultilineItems" value="!=100"/> |
| 81 |
<property name="exact" value="false" phpcs-only="true"/> |
| 82 |
</properties> |
| 83 |
</rule> |
| 84 |
|
| 85 |
<rule ref="WordPress"> |
| 86 |
<!-- Disable inline comment ending enforcement --> |
| 87 |
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/> |
| 88 |
<!-- Disable requirement for a short description in doc comments --> |
| 89 |
<exclude name="Generic.Commenting.DocComment.MissingShort"/> |
| 90 |
<!-- Disable snake_case requirement for method names --> |
| 91 |
<exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid"/> |
| 92 |
<!-- Disable enforcement of full stops at the end of parameter comments --> |
| 93 |
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"/> |
| 94 |
<exclude name="Squiz.Commenting.FunctionComment.EmptyThrows"/> |
| 95 |
<exclude name="WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode"/> |
| 96 |
<exclude name="WordPress.PHP.YodaConditions.NotYoda"/> |
| 97 |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterOpenParenthesis"/> |
| 98 |
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket"/> |
| 99 |
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket"/> |
| 100 |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeCloseParenthesis"/> |
| 101 |
<exclude name="Generic.Commenting.DocComment.ShortNotCapital"/> |
| 102 |
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/> |
| 103 |
<exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceAfterOpen"/> |
| 104 |
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.Found"/> |
| 105 |
<exclude name="Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure"/> |
| 106 |
<exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceBeforeClose"/> |
| 107 |
<exclude name="WordPress.PHP.DontExtract.extract_extract"/> |
| 108 |
<exclude name="Squiz.Commenting.FileComment.Missing"/> |
| 109 |
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch"/> |
| 110 |
<exclude name="WordPress.PHP.DisallowShortTernary.Found"/> |
| 111 |
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found"/> |
| 112 |
<exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterOpen"/> |
| 113 |
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"/> |
| 114 |
<exclude name="PEAR.Functions.FunctionCallSignature.Indent"/> |
| 115 |
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine"/> |
| 116 |
<exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeEnd"/> |
| 117 |
<exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeOpen"/> |
| 118 |
</rule> |
| 119 |
</ruleset> |