-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpcs.xml
More file actions
113 lines (91 loc) · 3.99 KB
/
Copy pathphpcs.xml
File metadata and controls
113 lines (91 loc) · 3.99 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
<?xml version="1.0"?>
<!-- File: phpcs.xml -->
<ruleset name="Framework Plugin">
<description>PHPCS configuration for the Framework Plugin</description>
<!-- Show progress and sniff codes -->
<arg value="ps"/>
<!-- Use colors in output -->
<arg name="colors"/>
<!-- Show results with . and ! -->
<arg value="n"/>
<!-- Paths to check -->
<file>.</file>
<!-- Exclude patterns -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/build/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/.git/*</exclude-pattern>
<exclude-pattern>*/assets/*</exclude-pattern>
<exclude-pattern>*/languages/*</exclude-pattern>
<exclude-pattern>*index.php</exclude-pattern>
<!-- Exclude JavaScript files -->
<exclude-pattern>*.js</exclude-pattern>
<exclude-pattern>./assets/js/*</exclude-pattern> <!-- Example for a specific JS directory -->
<!-- WordPress Coding Standards -->
<rule ref="WordPress">
<!-- Allow short array syntax -->
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
<!-- We use namespaces, so this is not needed -->
<exclude name="WordPress.Files.FileName"/>
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>
<!-- We prefer short array syntax. -->
<exclude name="Generic.Arrays.DisallowLongArraySyntax.Found"/>
<exclude name="Universal.Arrays.DisallowShortArraySyntax.Found"/>
<!-- We prefer Yoda conditions to be optional -->
<exclude name="WordPress.PHP.YodaConditions.NotYoda"/>
<!-- Allow multiple assignments -->
<exclude name="Squiz.PHP.DisallowMultipleAssignments"/>
<!-- We don't always need to escape in admin contexts -->
<exclude name="WordPress.Security.EscapeOutput.OutputNotEscaped"/>
</rule>
<!-- WordPress Extra Standards -->
<rule ref="WordPress-Extra">
<!-- Allow short array syntax -->
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
</rule>
<!-- WordPress Documentation Standards -->
<rule ref="WordPress-Docs"/>
<!-- Check for cross-version compatibility for PHP 8.1+ -->
<config name="testVersion" value="8.1-"/>
<!-- Verify that everything in the global namespace is prefixed -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<!-- Define our prefixes -->
<property name="prefixes" type="array">
<element value="FRAMEWORK"/>
<element value="framework "/>
<element value="framework_plugin"/>
<element value="AcornFramework"/>
</property>
</properties>
<!-- Allow exceptions for namespaced code -->
<exclude-pattern>*/src/*</exclude-pattern>
</rule>
<!-- Enforce short array syntax -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<!-- Set minimum supported WP version -->
<config name="minimum_supported_wp_version" value="5.9"/>
<!-- Text domain check -->
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="acorn-framework"/>
</property>
</properties>
</rule>
<!-- Enforce PSR-4 autoloading standard for src directory -->
<rule ref="PSR1.Classes.ClassDeclaration">
<include-pattern>*/src/*</include-pattern>
</rule>
<!-- Custom sniffs for our specific use cases -->
<rule ref="Squiz.Commenting.ClassComment">
<include-pattern>*/src/*</include-pattern>
</rule>
<rule ref="Squiz.Commenting.FunctionComment">
<include-pattern>*/src/*</include-pattern>
<!-- Allow missing param comments for simple setters/getters -->
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/>
</rule>
</ruleset>