-
Notifications
You must be signed in to change notification settings - Fork 0
/
.phpcs.xml.dist
135 lines (130 loc) · 10.4 KB
/
.phpcs.xml.dist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards based custom ruleset for your plugin">
<description>Generally-applicable sniffs for WordPress plugins.</description>
<!-- What to scan -->
<file>.</file>
<exclude-pattern>/\.backup/</exclude-pattern>
<exclude-pattern>/\.dev-notes/</exclude-pattern>
<exclude-pattern>/\.img-src/</exclude-pattern>
<exclude-pattern>/assets/css/bootstrap.*</exclude-pattern>
<exclude-pattern>/assets/fontawesome/</exclude-pattern>
<exclude-pattern>/assets/img/</exclude-pattern>
<exclude-pattern>/assets/js/bootstrap\..*</exclude-pattern>
<exclude-pattern>/gulpfile.js/</exclude-pattern>
<exclude-pattern>/tests/</exclude-pattern>
<exclude-pattern>/node_modules/</exclude-pattern>
<exclude-pattern>/node_tasks/</exclude-pattern>
<exclude-pattern>/vendor/</exclude-pattern>
<!-- How to scan -->
<!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
<!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
<arg value="sp"/> <!-- Show sniff and progress -->
<arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit -->
<arg name="colors"/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="8"/><!-- Enables parallel processing when available for faster results. -->
<ini name="memory_limit" value="64M"/>
<!-- Rules: Check PHP version compatibility -->
<!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
<config name="testVersion" value="7.0-"/>
<!-- https://github.com/PHPCompatibility/PHPCompatibilityWP -->
<rule ref="PHPCompatibilityWP"/>
<!-- Rules: WordPress Coding Standards -->
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
<config name="minimum_supported_wp_version" value="4.0"/>
<rule ref="WordPress">
<exclude name="Generic.Classes.OpeningBraceSameLine.BraceOnNewLine"></exclude>
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedIf"></exclude>
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter.Found"></exclude>
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed"></exclude>
<exclude name="Generic.Files.EndFileNewline.NotFound"></exclude>
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning"></exclude>
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine"></exclude>
<exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceAfterOpen"></exclude>
<exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceBeforeClose"></exclude>
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed"></exclude>
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect"></exclude>
<exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact"></exclude>
<exclude name="NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceAfterArrayOpenerSingleLine"></exclude>
<exclude name="NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceBeforeArrayCloserSingleLine"></exclude>
<exclude name="PEAR"></exclude>
<exclude name="PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.Changed"></exclude>
<exclude name="PHPCompatibility.Variables.ForbiddenGlobalVariableVariable.NonBareVariableFound"></exclude>
<exclude name="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody"></exclude>
<exclude name="PSR2.Namespaces.NamespaceDeclaration.BlankLineAfter"></exclude>
<exclude name="Squiz.Commenting.ClassComment.Missing"></exclude>
<exclude name="Squiz.Commenting.ClosingDeclarationComment.Incorrect"></exclude>
<exclude name="Squiz.Commenting.FileComment.Missing"></exclude>
<exclude name="Squiz.Commenting.FileComment.SpacingAfterComment"></exclude>
<exclude name="Squiz.Commenting.FunctionComment.Missing"></exclude>
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"></exclude>
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"></exclude>
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType"></exclude>
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"></exclude>
<exclude name="Squiz.Commenting.VariableComment.Missing"></exclude>
<exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace"></exclude>
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen"></exclude>
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose"></exclude>
<exclude name="Squiz.PHP.CommentedOutCode.Found"></exclude>
<exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterEnd"></exclude>
<exclude name="Squiz.PHP.NonExecutableCode.ReturnNotRequired"></exclude>
<exclude name="Squiz.Strings.ConcatenationSpacing.PaddingFound"></exclude>
<exclude name="Squiz.WhiteSpace.SemicolonSpacing.Incorrect"></exclude>
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine"></exclude>
<exclude name="Universal.Arrays.DisallowShortArraySyntax.Found"></exclude>
<exclude name="Universal.ControlStructures.DisallowLonelyIf.Found"></exclude>
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.NoSpaceAfterArrayOpener"></exclude>
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.NoSpaceBeforeArrayCloser"></exclude>
<exclude name="WordPress.Arrays.ArrayKeySpacingRestrictions.NoSpacesAroundArrayKeys"></exclude>
<exclude name="WordPress.Arrays.CommaAfterArrayItem.NoComma"></exclude>
<exclude name="WordPress.Arrays.CommaAfterArrayItem.NoSpaceAfterComma"></exclude>
<exclude name="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned"></exclude>
<exclude name="WordPress.Files.FileName.InvalidClassFileName"></exclude>
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"></exclude>
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound"></exclude>
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound"></exclude>
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedNamespaceFound"></exclude>
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound"></exclude>
<exclude name="WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid"></exclude>
<exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid"></exclude>
<exclude name="WordPress.NamingConventions.ValidVariableName.PropertyNotSnakeCase"></exclude>
<exclude name="WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase"></exclude>
<exclude name="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase"></exclude>
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace"></exclude>
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_error_log"></exclude>
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_print_r"></exclude>
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_var_export"></exclude>
<exclude name="WordPress.PHP.DontExtract.extract_extract"></exclude>
<exclude name="WordPress.PHP.StrictInArray.MissingTrueStrict"></exclude>
<exclude name="WordPress.Security.EscapeOutput.OutputNotEscaped"></exclude><!-- this cause super stupid required escape in `sprintf()` with gettext with placeholders. it will becomes escape variable and escape gettext (double escape). see Activation.php at `activation()` method. -->
<exclude name="WordPress.Security.EscapeOutput.UnsafePrintingFunction"></exclude><!-- this cause "All output should be run through an escaping function" error. this is stupid because it should be able to render HTML if needed. -->
<exclude name="WordPress.Security.NonceVerification.Recommended"></exclude><!-- this cause "Processing form data without nonce verification" error while it is called from edit profile hook in WP core which is already verfiy nonce. -->
<exclude name="WordPress.Security.NonceVerification.Missing"></exclude><!-- this cause "Processing form data without nonce verification" error while it is called from edit profile hook in WP core which is already verfiy nonce. -->
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing"></exclude>
<exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceBefore"></exclude>
<exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceAfter"></exclude>
<exclude name="WordPress.WP.AlternativeFunctions.curl_curl_init"></exclude>
<exclude name="WordPress.WP.AlternativeFunctions.curl_curl_setopt"></exclude>
<exclude name="WordPress.WP.AlternativeFunctions.curl_curl_exec"></exclude>
<exclude name="WordPress.WP.AlternativeFunctions.curl_curl_close"></exclude>
<exclude name="WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents"></exclude>
<exclude name="WordPress.WP.AlternativeFunctions.json_encode_json_encode"></exclude><!-- The function `wp_json_encode()` does not support PHP less than 5.6. -->
<exclude name="WordPress.WP.AlternativeFunctions.strip_tags_strip_tags"></exclude>
<exclude name="WordPress.WP.EnqueuedResourceParameters.MissingVersion"></exclude>
<exclude name="WordPress.WP.EnqueuedResourceParameters.NoExplicitVersion"></exclude>
<exclude name="WordPress.WP.I18n.MissingArgDomain"></exclude>
</rule>
<rule ref="WordPress.WP.I18n">
<properties>
<!-- Value: replace the text domain used. -->
<property name="text_domain" type="array" value="rd-cookie-notice"/>
</properties>
</rule>
<!-- some of PSR 12 ( https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/PSR12/ruleset.xml ) -->
<rule ref="PSR2.Methods.FunctionClosingBrace"></rule>
<rule ref="Squiz.Functions.FunctionDeclaration"></rule>
<rule ref="Squiz.Functions.LowercaseFunctionKeywords"></rule>
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration"></rule>
<!-- end some of PSR 12 -->
</ruleset>