-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpcs.xml
More file actions
155 lines (127 loc) · 5.21 KB
/
phpcs.xml
File metadata and controls
155 lines (127 loc) · 5.21 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
<?xml version="1.0"?>
<ruleset name="WordPress Plugin Coding Standards">
<description>WordPress coding standards</description>
<!-- Files to check -->
<file>.</file>
<!-- Exclude patterns -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/.private/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/.git/*</exclude-pattern>
<exclude-pattern>*/.github/*</exclude-pattern>
<exclude-pattern>*/build/*</exclude-pattern>
<exclude-pattern>*/dist/*</exclude-pattern>
<exclude-pattern>*/css/*</exclude-pattern>
<exclude-pattern>*/js/*</exclude-pattern>
<exclude-pattern>*/stubs/*</exclude-pattern>
<exclude-pattern>*.css</exclude-pattern>
<exclude-pattern>*.js</exclude-pattern>
<!-- Use WordPress-Extra coding standards (includes WordPress-Core) -->
<rule ref="WordPress-Extra">
<!-- Allow short array syntax [] instead of array() -->
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
<!-- Allow longer lines for readability -->
<exclude name="Generic.Files.LineLength"/>
<!-- Allow direct database queries when using $wpdb properly -->
<exclude name="WordPress.DB.DirectDatabaseQuery"/>
</rule>
<!-- WordPress documentation standards -->
<rule ref="WordPress-Docs"/>
<!-- Disabled: these rules enforce spaces instead of tabs, which conflicts with WordPress standards. -->
<!-- WordPress standards require tabs for indentation, not spaces. -->
<!--
<rule ref="Generic.WhiteSpace.DisallowTabIndent">
</rule>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="tabIndent" value="false"/>
</properties>
</rule>
-->
<!-- Disabled: space-indent flagging is not needed with tab indentation. -->
<!--
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent">
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent"/>
</rule>
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed">
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed"/>
</rule>
-->
<!-- Disabled: WordPress allows tabs for indentation. -->
<!--
<rule ref="Universal.WhiteSpace.DisallowInlineTabs">
</rule>
-->
<!-- Additional WordPress-specific spacing rules -->
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing"/>
<rule ref="WordPress.WhiteSpace.OperatorSpacing"/>
<!-- Enforce WordPress indentation standards -->
<rule ref="WordPress.Arrays.ArrayIndentation"/>
<rule ref="WordPress.Arrays.MultipleStatementAlignment"/>
<!-- WordPress function call formatting -->
<rule ref="PEAR.Functions.FunctionCallSignature">
<properties>
<property name="allowMultipleArguments" value="false"/>
</properties>
</rule>
<!-- WordPress class and method formatting -->
<rule ref="PSR2.Classes.ClassDeclaration"/>
<rule ref="PSR2.Methods.MethodDeclaration"/>
<!-- File formatting -->
<rule ref="Generic.Files.ByteOrderMark"/>
<rule ref="Generic.Files.LineEndings">
<properties>
<property name="eolChar" value="\n"/>
</properties>
</rule>
<!-- WordPress security and best practices -->
<rule ref="WordPress.Security"/>
<!-- WooCommerce registers this capability when active. -->
<rule ref="WordPress.WP.Capabilities">
<properties>
<property name="custom_capabilities" type="array">
<element value="manage_woocommerce"/>
<element value="edit_product"/>
</property>
</properties>
</rule>
<!-- WordPress internationalization configuration -->
<rule ref="WordPress.WP.I18n">
<properties>
<!-- Set the text domain for internationalization -->
<property name="text_domain" type="array">
<element value="optimizations-ace-mc"/>
</property>
</properties>
</rule>
<!-- WordPress naming conventions (snake_case) -->
<rule ref="WordPress.NamingConventions.ValidFunctionName"/>
<rule ref="WordPress.NamingConventions.ValidVariableName"/>
<rule ref="WordPress.NamingConventions.ValidHookName"/>
<!-- WordPress PHP compatibility -->
<rule ref="PHPCompatibilityWP">
<include-pattern>*\.php$</include-pattern>
</rule>
<!-- PHPCSExtra standards for additional code quality checks -->
<rule ref="Modernize">
<exclude name="Modernize.FunctionCalls.Dirname.Nested"/>
</rule>
<!-- Allow PHP short array syntax. -->
<rule ref="Universal.Arrays.DisallowShortArraySyntax">
<severity>0</severity>
</rule>
<rule ref="NormalizedArrays">
<exclude name="Universal.Arrays.DisallowShortArraySyntax"/>
</rule>
<!-- Set minimum WordPress version for deprecated function checks -->
<config name="minimum_wp_version" value="6.8"/>
<config name="testVersion" value="8.2-"/>
<!-- Show progress -->
<arg value="p"/>
<!-- Show sniff codes in all reports -->
<arg value="s"/>
<!-- Use colors in output -->
<arg name="colors"/>
</ruleset>