-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphpcs.xml
107 lines (89 loc) · 4.04 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
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards">
<description>A custom set of code standard rules to check for WordPress code.</description>
<!-- How to scan -->
<arg value="sp"/><!-- Show sniff and progress -->
<arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit -->
<arg name="extensions" value="php"/>
<arg name="parallel" value="10"/><!-- Enables parallel processing when available for faster results. -->
<arg name="cache" value=".phpcs.cache"/>
<!-- Check for cross-version support for PHP 7.4 and higher. -->
<config name="testVersion" value="7.4-"/>
<!-- Minimum WP version to check for usage of deprecated functions, classes and function parameters -->
<config name="minimum_supported_wp_version" value="5.4.1"/>
<!-- Rules: -->
<rule ref="PHPCompatibilityWP"/>
<!-- What to scan -->
<file>./</file>
<!-- Exclude "Third-party" -->
<!-- <exclude-pattern>wp-content/themes/twentytwenty/</exclude-pattern> -->
<!-- Exclude common files -->
<exclude-pattern>*/\.idea/*</exclude-pattern>
<exclude-pattern>*/\.github/*</exclude-pattern>
<exclude-pattern>*/\.idea/*</exclude-pattern>
<exclude-pattern>*/\.make/*</exclude-pattern>
<exclude-pattern>*/\.wordpress-org/*</exclude-pattern>
<exclude-pattern>*/assets/*</exclude-pattern>
<exclude-pattern>*/languages/*</exclude-pattern>
<exclude-pattern>*/lib/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/src/js/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*\.js</exclude-pattern>
<exclude-pattern>*\.mo</exclude-pattern>
<exclude-pattern>*\.po</exclude-pattern>
<exclude-pattern>*\.twig</exclude-pattern>
<exclude-pattern>*\.css</exclude-pattern>
<exclude-pattern>*\.scss</exclude-pattern>
<exclude-pattern>wp-content/uploads/</exclude-pattern>
<rule ref="PSR12"/>
<!--<rule ref="Generic.Metrics.CyclomaticComplexity">
<properties>
<property name="complexity" value="3"/>
<property name="absoluteComplexity" value="5"/>
</properties>
</rule>-->
<rule ref="Generic.Metrics.NestingLevel">
<properties>
<property name="absoluteNestingLevel" value="3"/>
</properties>
</rule>
<!-- Disallow long array syntax. -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax.Found"/>
<rule ref="Generic.Files.LineLength.TooLong">
<severity>0</severity>
</rule>
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<severity>0</severity>
</rule>
<!-- Namespacing required for classes. -->
<!-- <rule ref="PSR1.Classes.ClassDeclaration" /> -->
<!-- Namespacing required for functions. -->
<!-- <rule ref="PSR2.Namespaces.NamespaceDeclaration" /> -->
<!-- Forbidden functions -->
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<element key="delete" value="unset"/>
<element key="print" value="echo"/>
<element key="create_function" value="null"/>
<element key="sizeof" value="count"/>
<!-- <element key="var_dump" value="null"/> duplicate of WP rule-->
<element key="print_r" value="null"/>
<element key="eval" value="null"/>
<element key="compact" value="null"/>
</property>
</properties>
</rule>
<rule ref="Generic.Formatting.MultipleStatementAlignment">
<properties>
<property name="alignAtEnd" value="false" />
<property name="maxPadding" value="1"/>
<property name="error" value="true"/>
</properties>
</rule>
<!-- Fix errors "No PHP code was found" in GitHub action. These errors show on GitHub actions. It can happen in case you run PHPCS into Docker container -->
<rule ref="Internal.NoCodeFound">
<severity>0</severity>
</rule>
</ruleset>