-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphpcs.xml
151 lines (132 loc) · 6.77 KB
/
phpcs.xml
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?xml version="1.0" ?>
<ruleset name="Business Directory Plugin PHP Coding Standards Rules">
<rule ref="WordPress">
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<exclude name="PEAR.NamingConventions.ValidClassName.Invalid" />
<exclude name="PEAR.NamingConventions.ValidClassName.StartWithCapital" />
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
<exclude name="WordPress.VIP.RestrictedFunctions.wp_remote_get_wp_remote_get" />
<exclude name="WordPress.PHP.YodaConditions.NotYoda" />
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" />
<!-- High Priority -->
<exclude name="WordPress.Security.ValidatedSanitizedInput.InputNotValidated" />
<exclude name="WordPress.Security.ValidatedSanitizedInput.MissingUnslash" />
<exclude name="WordPress.DB.PreparedSQLPlaceholders.LikeWildcardsInQueryWithPlaceholder" />
<exclude name="WordPress.Security.EscapeOutput.OutputNotEscaped" />
<exclude name="PSR2.Files.ClosingTag.NotAllowed" />
<exclude name="WordPress.DB.PreparedSQL.NotPrepared" />
<!-- Fast -->
<exclude name="Generic.PHP.LowerCaseConstant.Found" />
<exclude name="WordPress.NamingConventions.ValidVariableName.PropertyNotSnakeCase" />
<exclude name="WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase" />
<exclude name="WordPress.Arrays.ArrayIndentation.ItemNotAligned" />
<exclude name="PSR2.Classes.PropertyDeclaration.ScopeMissing" />
<exclude name="Squiz.Commenting.FunctionCommentThrowTag.Missing" />
<exclude name="PSR2.Classes.PropertyDeclaration.VarUsed" />
<exclude name="WordPress.DateTime.RestrictedFunctions.date_date" />
<!-- Temporary exclusions -->
<exclude name="Generic.PHP.NoSilencedErrors.Forbidden" />
<exclude name="WordPress.PHP.DontExtract.extract_extract" />
<exclude name="WordPress.Security.NonceVerification.Missing" />
<exclude name="WordPress.DB.PreparedSQL.InterpolatedNotPrepared" />
<exclude name="Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure" />
<exclude name="WordPress.WP.I18n.MissingTranslatorsComment" />
<exclude name="WordPress.WhiteSpace.PrecisionAlignment.Found" />
<exclude name="WordPress.PHP.StrictComparisons.LooseComparison" />
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning" />
<exclude name="Squiz.PHP.DisallowMultipleAssignments.Found" />
<exclude name="Universal.Files.SeparateFunctionsFromOO.Mixed" />
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing" />
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" />
<exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact" />
<exclude name="PEAR.Functions.FunctionCallSignature.Indent" />
<exclude name="WordPress.Arrays.ArrayIndentation.CloseBraceNotAligned" />
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect" />
<exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace" />
<exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterEnd" />
<exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterOpen" />
<exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeOpen" />
<exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeEnd" />
<exclude name="Squiz.PHP.EmbeddedPhp.NoSemicolon" />
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments" />
<exclude name="Generic.ControlStructures.InlineControlStructure.NotAllowed" />
<exclude name="WordPress.WP.GlobalVariablesOverride.Prohibited" />
<exclude name="Squiz.Scope.MethodScope.Missing" />
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedIf" />
<exclude name="Squiz.Commenting.FileComment" />
<exclude name="Squiz.Commenting.FunctionComment" />
<exclude name="Squiz.Commenting.VariableComment" />
<exclude name="Generic.Commenting.DocComment.MissingShort" />
<exclude name="Squiz.Commenting.InlineComment" />
<exclude name="Squiz.Commenting.ClassComment" />
<exclude name="Squiz.Commenting.BlockComment" />
</rule>
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="business-directory-plugin" />
</property>
</properties>
</rule>
<rule ref="WordPress.Security.EscapeOutput">
<properties>
<property name="customAutoEscapedFunctions" type="array" value="wpbdp_sanitize_value,wpbdp_get_server_value,wpbdp_render_page,wpbdp_admin_footer,wpbdp_render,wpbdp_render_msg,wp_nonce_url"/>
</properties>
</rule>
<rule ref="WordPressVIPMinimum">
<exclude name="WordPressVIPMinimum.Performance.RemoteRequestTimeout.timeout_timeout" />
<exclude name="WordPressVIPMinimum.Variables.RestrictedVariables.user_meta__wpdb__users" />
<exclude name="WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_unlink" />
<exclude name="WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_fwrite" />
<exclude name="WordPressVIPMinimum.Functions.RestrictedFunctions.term_exists_term_exists" />
</rule>
<!-- Treat these warnings as errors -->
<rule ref="Generic.Formatting.MultipleStatementAlignment.NotSameWarning">
<severity>8</severity>
<type>error</type>
</rule>
<rule ref="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned">
<severity>8</severity>
<type>error</type>
</rule>
<!-- Add some rules from the Slevomat Coding Standard -->
<rule ref="SlevomatCodingStandard.PHP.UselessParentheses"/>
<rule ref="SlevomatCodingStandard.Files.LineLength">
<properties>
<property name="lineLengthLimit" value="250" />
</properties>
<exclude-pattern>tests/*</exclude-pattern>
<exclude-pattern>templates/*</exclude-pattern>
<exclude-pattern>views/*</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.Functions.FunctionLength">
<properties>
<property name="maxLinesLength" value="100" />
</properties>
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<!-- Set rules for Cognitive Complexity -->
<rule ref="SlevomatCodingStandard.Complexity.Cognitive">
<properties>
<property name="warningThreshold" value="32" />
<property name="errorThreshold" value="10" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh"/>
<!-- Check for cross-version support for PHP 7 and higher. -->
<config name="testVersion" value="7.0-" />
<!-- Show details about violated sniffs -->
<arg value="s" />
<!-- Iterate over all PHP files by default -->
<arg name="extensions" value="php" />
<file>.</file>
<!-- Ignore auto-generated code -->
<exclude-pattern>tests/*</exclude-pattern>
<exclude-pattern>vendor/*</exclude-pattern>
<exclude-pattern>vendors/*</exclude-pattern>
<exclude-pattern>node_modules/*</exclude-pattern>
<exclude-pattern>themes/*</exclude-pattern> <!-- Remove me -->
<exclude-pattern>includes/admin/upgrades/migrations/*</exclude-pattern>
<exclude-pattern>stubs.php</exclude-pattern>
</ruleset>