-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathphpcs.xml
More file actions
194 lines (161 loc) · 7.28 KB
/
phpcs.xml
File metadata and controls
194 lines (161 loc) · 7.28 KB
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<?xml version="1.0"?>
<ruleset name="Super Forms WordPress Coding Standards">
<description>WordPress Coding Standards configuration for Super Forms plugin</description>
<!-- Include all files in the project -->
<file>.</file>
<!-- Exclude specific directories and files -->
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/build/*</exclude-pattern>
<exclude-pattern>*/dist/*</exclude-pattern>
<exclude-pattern>*/docs/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/coverage/*</exclude-pattern>
<exclude-pattern>*.min.js</exclude-pattern>
<exclude-pattern>*.min.css</exclude-pattern>
<exclude-pattern>*/lib/*</exclude-pattern>
<exclude-pattern>*/assets/js/jquery-*</exclude-pattern>
<exclude-pattern>*/assets/js/tinymce/*</exclude-pattern>
<exclude-pattern>*/src/includes/admin/plugin-update-checker/*</exclude-pattern>
<exclude-pattern>*/src/includes/extensions/stripe/stripe-php/*</exclude-pattern>
<exclude-pattern>*/src/lib/*</exclude-pattern>
<exclude-pattern>*/src/assets/js/frontend/jquery-file-upload/*</exclude-pattern>
<exclude-pattern>*/src/assets/js/frontend/datepicker/*</exclude-pattern>
<exclude-pattern>*/src/add-ons/super-forms-calculator/assets/js/frontend/mathjs.min.js</exclude-pattern>
<!-- Show progress -->
<arg value="p"/>
<!-- Show sniff codes in all reports -->
<arg value="s"/>
<!-- Use colors in output -->
<arg name="colors"/>
<!-- Strip the filepaths down to the relevant bit -->
<arg name="basepath" value="."/>
<!-- Check up to 20 files simultaneously -->
<arg name="parallel" value="20"/>
<!-- Only check PHP files -->
<arg name="extensions" value="php"/>
<!-- Include WordPress Coding Standards -->
<rule ref="WordPress">
<!-- Exclude rules that conflict with our existing codebase -->
<exclude name="WordPress.Files.FileName"/>
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>
<!-- Allow short array syntax -->
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
<!-- Allow camelCase for JavaScript-style naming -->
<exclude name="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase"/>
<exclude name="WordPress.NamingConventions.ValidVariableName.PropertyNotSnakeCase"/>
<!-- We use tabs for indentation, not spaces -->
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent"/>
</rule>
<!-- Include WordPress-Extra rules -->
<rule ref="WordPress-Extra">
<!-- Allow short array syntax -->
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
</rule>
<!-- Include WordPress-Docs rules -->
<rule ref="WordPress-Docs"/>
<!-- Include WordPress VIP rules for performance -->
<rule ref="WordPress-VIP-Go">
<!-- Allow file operations for plugin functionality -->
<exclude name="WordPress.VIP.FileSystemWritesDisallow"/>
<exclude name="WordPress.VIP.DirectDatabaseQuery"/>
</rule>
<!-- Set the minimum supported WordPress version -->
<config name="minimum_supported_wp_version" value="5.8"/>
<!-- Set the minimum supported PHP version -->
<config name="testVersion" value="7.4-"/>
<!-- Prefix all globals with super_forms or SUPER_FORMS -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
<element value="super_forms"/>
<element value="SUPER_FORMS"/>
<element value="super"/>
<element value="SUPER"/>
<element value="sfui"/>
<element value="SF"/>
</property>
</properties>
</rule>
<!-- Ensure proper text domain usage -->
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="super-forms"/>
</property>
</properties>
</rule>
<!-- Set custom properties for WordPress.Security.EscapeOutput -->
<rule ref="WordPress.Security.EscapeOutput">
<properties>
<property name="customAutoEscapedFunctions" type="array">
<element value="SUPER_Common::decode"/>
<element value="SUPER_Common::convert_tags"/>
</property>
</properties>
</rule>
<!-- Allow specific WordPress functions -->
<rule ref="WordPress.DB.DirectDatabaseQuery">
<properties>
<property name="customCacheDeleteFunctions" type="array">
<element value="wp_cache_delete"/>
<element value="clean_post_cache"/>
</property>
</properties>
</rule>
<!-- PHP Compatibility checks -->
<rule ref="PHPCompatibilityWP"/>
<!-- Security-focused rules -->
<rule ref="WordPress.Security.NonceVerification"/>
<rule ref="WordPress.Security.ValidatedSanitizedInput"/>
<rule ref="WordPress.Security.EscapeOutput"/>
<rule ref="WordPress.Security.SafeRedirect"/>
<!-- Performance rules -->
<rule ref="WordPress.DB.PreparedSQL"/>
<rule ref="WordPress.DB.PreparedSQLPlaceholders"/>
<rule ref="WordPress.DB.RestrictedFunctions"/>
<rule ref="WordPress.DB.RestrictedClasses"/>
<!-- Accessibility rules -->
<rule ref="WordPress.WP.AlternativeFunctions"/>
<rule ref="WordPress.WP.DeprecatedFunctions"/>
<rule ref="WordPress.WP.DeprecatedClasses"/>
<rule ref="WordPress.WP.DeprecatedParameters"/>
<!-- Code quality rules -->
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
<rule ref="Generic.Commenting.Todo"/>
<rule ref="Generic.Commenting.Fixme"/>
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<!-- Custom severity levels -->
<rule ref="WordPress.PHP.DevelopmentFunctions">
<type>error</type>
</rule>
<rule ref="WordPress.PHP.DiscouragedPHPFunctions">
<type>warning</type>
</rule>
<!-- Allow specific exceptions for legacy code -->
<rule ref="WordPress.Arrays.ArrayDeclarationSpacing">
<exclude-pattern>*/src/includes/shortcodes/predefined-arrays.php</exclude-pattern>
</rule>
<!-- Allow specific patterns for form builder functionality -->
<rule ref="WordPress.Security.ValidatedSanitizedInput">
<exclude-pattern>*/src/includes/class-ajax.php</exclude-pattern>
</rule>
<!-- Custom whitelist for specific functions -->
<rule ref="WordPress.Security.NonceVerification">
<exclude-pattern>*/src/includes/class-triggers.php</exclude-pattern>
</rule>
<!-- Allow file operations for plugin core functionality -->
<rule ref="WordPress.WP.AlternativeFunctions">
<properties>
<property name="exclude" type="array">
<element value="file_get_contents"/>
<element value="file_put_contents"/>
<element value="fopen"/>
<element value="fclose"/>
<element value="fwrite"/>
</property>
</properties>
</rule>
</ruleset>