| 1 |
<?xml version="1.0"?> |
| 2 |
<ruleset name="WordPress Theme Coding Standards"> |
| 3 |
<!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml --> |
| 4 |
<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards --> |
| 5 |
<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki --> |
| 6 |
<!-- See https://github.com/wimg/PHPCompatibility --> |
| 7 |
|
| 8 |
<!-- Set a description for this ruleset. --> |
| 9 |
<description>A custom set of code standard rules to check for WordPress themes.</description> |
| 10 |
|
| 11 |
<!-- Pass some flags to PHPCS: |
| 12 |
p flag: Show progress of the run. |
| 13 |
s flag: Show sniff codes in all reports. |
| 14 |
v flag: Print verbose output. |
| 15 |
n flag: Do not print warnings. |
| 16 |
--> |
| 17 |
<arg value="psvn"/> |
| 18 |
|
| 19 |
<!-- Only check the PHP, CSS and SCSS files. JS files are checked separately with JSCS and JSHint. --> |
| 20 |
<arg name="extensions" value="php,css,scss/css"/> |
| 21 |
|
| 22 |
<!-- Check all files in this directory and the directories below it. --> |
| 23 |
<file>.</file> |
| 24 |
|
| 25 |
<!-- Include the WordPress ruleset, with exclusions. --> |
| 26 |
<rule ref="WordPress"> |
| 27 |
|
| 28 |
<!-- Nazi-strict intendation rules we want to exclude --> |
| 29 |
<exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact" /> |
| 30 |
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect" /> |
| 31 |
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" /> |
| 32 |
<exclude name="PEAR.Functions.FunctionCallSignature.Indent" /> |
| 33 |
<exclude name="WordPress.Arrays.ArrayIndentation.ItemNotAligned" /> |
| 34 |
<exclude name="WordPress.Arrays.ArrayIndentation.MultiLineArrayItemNotAligned" /> |
| 35 |
<exclude name="WordPress.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed" /> |
| 36 |
<exclude name="WordPress.Arrays.ArrayIndentation.CloseBraceNotAligned" /> |
| 37 |
<exclude name="PEAR.Functions.FunctionCallSignature.OpeningIndent" /> |
| 38 |
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" /> |
| 39 |
|
| 40 |
<!-- Don't require too strict inline commenting, it's a good thing to documentate, let's not make it frustrating --> |
| 41 |
<exclude name="Squiz.Commenting.FunctionComment.WrongStyle" /> |
| 42 |
<exclude name="Squiz.Commenting.ClassComment.WrongStyle" /> |
| 43 |
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" /> |
| 44 |
<exclude name="Squiz.Commenting.FunctionComment.Missing" /> |
| 45 |
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag" /> |
| 46 |
<exclude name="Squiz.Commenting.InlineComment.SpacingAfter" /> |
| 47 |
<exclude name="Squiz.Commenting.FileComment.Missing" /> |
| 48 |
<exclude name="Squiz.Commenting.LongConditionClosingComment.Missing" /> |
| 49 |
|
| 50 |
<!-- General code style related excludes --> |
| 51 |
<exclude name="Squiz.PHP.DisallowMultipleAssignments.Found" /> |
| 52 |
<exclude name="Squiz.PHP.EmbeddedPhp.MultipleStatements" /> |
| 53 |
<exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterOpen" /> |
| 54 |
<exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeEnd" /> |
| 55 |
<exclude name="Generic.Formatting.DisallowMultipleStatements.SameLine" /> |
| 56 |
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.AssociativeKeyFound" /> |
| 57 |
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound" /> |
| 58 |
<exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace" /> |
| 59 |
<exclude name="PHPCompatibility.PHP.NewFunctionArrayDereferencing.Found" /> |
| 60 |
|
| 61 |
<!-- General WordPress stuff we like to overrule --> |
| 62 |
<exclude name="WordPress.Files.FileName.InvalidClassFileName" /> |
| 63 |
|
| 64 |
<!-- Very strict VIP/discouraged rules that are not needed --> |
| 65 |
<exclude name="WordPress.XSS.EscapeOutput.OutputNotEscaped" /> |
| 66 |
<exclude name="WordPress.Functions.DontExtract.extract_extract" /> |
| 67 |
<exclude name="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma" /> |
| 68 |
<exclude name="Generic.Commenting.DocComment.MissingShort" /> |
| 69 |
<exclude name="Generic.Commenting.DocComment.SpacingBeforeTags" /> |
| 70 |
<exclude name="Squiz.PHP.EmbeddedPhp.NoSemicolon" /> |
| 71 |
<exclude name="PHPCompatibility.PHP.NewClosure.Found" /> |
| 72 |
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" /> |
| 73 |
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" /> |
| 74 |
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments" /> |
| 75 |
<exclude name="WordPress.PHP.DontExtract.extract_extract" /> |
| 76 |
|
| 77 |
<!-- Translations related, not always necessary, too strict --> |
| 78 |
<exclude name="WordPress.WP.I18n.MissingTranslatorsComment" /> |
| 79 |
|
| 80 |
<!-- EditorConfig makes sure this happens anyway & false positives happen with this --> |
| 81 |
<exclude name="Generic.Files.EndFileNewline.NotFound" /> |
| 82 |
|
| 83 |
<!-- Many times when developing a customer case we have placeholders for SVG includes, so unnecessary error reports happen with this rule --> |
| 84 |
<exclude name="Squiz.PHP.EmbeddedPhp.Empty" /> |
| 85 |
</rule> |
| 86 |
|
| 87 |
<!-- Verify that the text_domain is set to the desired text-domain. |
| 88 |
Multiple valid text domains can be provided as a comma-delimited list. --> |
| 89 |
<rule ref="WordPress.WP.I18n"> |
| 90 |
<properties> |
| 91 |
<property name="text_domain" type="array" value="wp-commerce7" /> |
| 92 |
</properties> |
| 93 |
</rule> |
| 94 |
|
| 95 |
<!-- Allow for theme specific exceptions to the file name rules based |
| 96 |
on the theme hierarchy. --> |
| 97 |
<rule ref="WordPress.Files.FileName"> |
| 98 |
<properties> |
| 99 |
<property name="is_theme" value="false" /> |
| 100 |
</properties> |
| 101 |
</rule> |
| 102 |
|
| 103 |
<!-- Include sniffs for PHP cross-version compatibility. |
| 104 |
<config name="testVersion" value="5.6-99.0"/> |
| 105 |
<rule ref="PHPCompatibility"/> --> |
| 106 |
|
| 107 |
<!--<config name="installed_paths" value="C:\php\composer\wpcs" />--> |
| 108 |
</ruleset> |