-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphpcs.xml
89 lines (70 loc) · 3.22 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
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards">
<arg name="colors" />
<arg value="ps" />
<arg name="basepath" value="." />
<arg name="parallel" value="50" />
<arg name="extensions" value="php" />
<!-- Lint all PHP files by default. -->
<file>includes</file>
<!-- Ensure all PHP code is compatible with PHP 7.4 and higher. -->
<rule ref="PHPCompatibilityWP" />
<config name="testVersion" value="7.4-"/>
<rule ref="WordPress" />
<!-- Require prepared SQL statements. -->
<rule ref="WordPress.DB.PreparedSQL" />
<rule ref="WordPress.DB.PreparedSQLPlaceholders" />
<!-- Disallow empty statements. -->
<rule ref="Generic.CodeAnalysis.EmptyStatement" />
<!-- Require correct usage of WP's i18n functions. -->
<rule ref="WordPress.WP.I18n">
<!-- Allow empty strings to be translated (e.g. space character) -->
<exclude name="WordPress.WP.I18n.NoEmptyStrings" />
</rule>
<!-- Disallow "development" functions like var_dump/print_r/phpinfo -->
<rule ref="WordPress.PHP.DevelopmentFunctions">
<!-- Allow triggering errors for reporting purposes. -->
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_error_log" />
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_trigger_error" />
<!-- Allow overriding the error handler. -->
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_set_error_handler" />
<!-- Allow changing error level. -->
<exclude name="WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure_error_reporting" />
<!-- Allow backtraces. -->
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace" />
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_wp_debug_backtrace_summary" />
<!-- Set remaining to errors. -->
<type>error</type>
</rule>
<!-- Require valid syntax. -->
<rule ref="Generic.PHP.Syntax" />
<!-- Require proper docblocks be used in all PHP files -->
<rule ref="WordPress-Docs">
<exclude name="Squiz.Commenting.FileComment.MissingPackageTag" />
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop" />
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNoFullStop" />
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType" />
<!-- Commenting hygiene is nice, but this excludes too many valid comment syntaxes. -->
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
</rule>
<!-- disable nonce checks on tests -->
<rule ref="WordPress.Security.NonceVerification">
<exclude-pattern>tests/*.php</exclude-pattern>
<exclude-pattern>tests/providers/*.php</exclude-pattern>
</rule>
<!-- Enforce camel case for class names -->
<rule ref="PEAR.NamingConventions.ValidClassName.Invalid">
<exclude-pattern>/phpunit/*</exclude-pattern>
</rule>
<!-- Ignore filename error since it requires WP core build process change -->
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
<exclude-pattern>/includes/*</exclude-pattern>
</rule>
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
<exclude-pattern>/includes/*</exclude-pattern>
</rule>
<exclude-pattern>*/wordpress/*</exclude-pattern>
<exclude-pattern>*/build/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
</ruleset>