-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathphpcs.xml
123 lines (105 loc) · 5.26 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
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards">
<description>A custom set of code standard rules to check for WordPress code.</description>
<rule ref="WordPress"/>
<!-- 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.0 and higher. -->
<config name="testVersion" value="7.0-"/>
<!-- Minimum WP version to check for usage of deprecated functions, classes and function parameters -->
<config name="minimum_supported_wp_version" value="5.9.0"/>
<!-- Rules: -->
<rule ref="PHPCompatibilityWP"/>
<!-- What to scan -->
<file>wp-content/plugins/easy-hide-admin-menu-items/</file>
<!-- 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>
<rule ref="WordPress">
<!-- Allow short ternary syntax and short arrays and short open tag -->
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
<exclude name="WordPress.PHP.DisallowShortTernary.Found"/>
<exclude name="Generic.PHP.DisallowShortOpenTag.EchoFound"/>
<exclude name="Generic.Commenting.DocComment.MissingShort"/>
<!-- Disable dot of end string docblock -->
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/>
<exclude name="WordPress.PHP.YodaConditions"/>
<exclude name="Generic.Files.LineEndings.InvalidEOLChar"/>
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"/>
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine"/>
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments"/>
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning"/>
</rule>
<!-- Disable comments blocks -->
<rule ref="WordPress-Docs">
<exclude name="Squiz.Commenting.FileComment.Missing"/>
<exclude name="Squiz.Commenting.FileComment.MissingPackageTag"/>
<exclude name="Squiz.Commenting.ClassComment.Missing"/>
<exclude name="Squiz.Commenting.FunctionComment.Missing"/>
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType"/>
<exclude name="Squiz.Commenting.VariableComment.Missing"/>
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/>
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag"/>
</rule>
<!-- Allow symbol `/` in hook names. -->
<rule ref="WordPress.NamingConventions.ValidHookName">
<properties>
<property name="additionalWordDelimiters" value="/"/>
</properties>
</rule>
<!-- Allow for underscores in theme template file names -->
<rule ref="WordPress.Files.FileName">
<properties>
<property name="is_theme" value="true"/>
</properties>
</rule>
<rule ref="Generic.Metrics.NestingLevel">
<properties>
<property name="absoluteNestingLevel" value="4"/>
</properties>
</rule>
<!-- Disallow long array syntax. -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax.Found"/>
<!-- Prohibit Yoda Conditions expressions -->
<rule ref="Generic.ControlStructures.DisallowYodaConditions"/>
<!-- 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"/>
<element key="print_r" value="null"/>
<element key="eval" value="null"/>
<element key="compact" value="null"/>
</property>
</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>