-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpcs.xml
More file actions
143 lines (112 loc) · 6.98 KB
/
phpcs.xml
File metadata and controls
143 lines (112 loc) · 6.98 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
<?xml version="1.0"?>
<ruleset name="GIOS Preferred WordPress Coding Standards">
<description>A custom set of rules for GIOS WordPress projects</description>
<!-- Include the WordPress-Extra standard. -->
<rule ref="WordPress-Extra">
<!-- Requiring spacing between param comments and non-params is pointless -->
<exclude name="Generic.Commenting.DocComment"/>
<!-- File comments are useless -->
<exclude name="Squiz.Commenting.FileComment"/>
<!-- Variable comments are useless -->
<exclude name="Squiz.Commenting.VariableComment"/>
<exclude name="Squiz.PHP.CommentedOutCode.Found"/>
<!-- Function comments are useless for tests -->
<exclude name="Squiz.Commenting.FunctionComment">
<exclude-pattern>*/tests/*</exclude-pattern>
</exclude>
<!-- We can enable the following later later -->
<exclude name="Squiz.Commenting.BlockComment.NoCapital"/>
<exclude name="Squiz.Commenting.InlineComment.NotCapital"/>
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/>
<exclude name="Squiz.Commenting.InlineComment.SpacingAfter"/>
<!-- This hits on assignment in conditionals, stupid -->
<exclude name="Squiz.PHP.DisallowMultipleAssignments.Found"/>
<!-- Don't worry about discouraged WordPress functions -->
<exclude name="WordPress.PHP.DiscouragedPHPFunctions"/>
<exclude name="WordPress.VIP.RestrictedFunctions"/>
<exclude name="WordPress.VIP.TimezoneChange"/>
<exclude name="Generic.PHP.NoSilencedErrors"/>
<exclude name="WordPress.WP.EnqueuedResources"/>
<exclude name="WordPress.VIP.SlowDBQuery"/>
<exclude name="WordPress.VIP.SuperGlobalInputUsage"/>
<exclude name="WordPress.VIP.ValidatedSanitizedInput"/>
<exclude name="WordPress.CSRF.NonceVerification"/>
<exclude name="WordPress.CSRF.NonceVerification"/>
<!-- Don't worry about discouraged curl functions -->
<exclude name="WordPress.WP.AlternativeFunctions.curl_curl_init"/>
<exclude name="WordPress.WP.AlternativeFunctions.curl_curl_setopt"/>
<exclude name="WordPress.WP.AlternativeFunctions.curl_curl_exec"/>
<exclude name="WordPress.WP.AlternativeFunctions.curl_curl_error"/>
<exclude name="WordPress.WP.AlternativeFunctions.curl_curl_strerror"/>
<exclude name="WordPress.WP.AlternativeFunctions.curl_curl_errno"/>
<exclude name="WordPress.WP.AlternativeFunctions.curl_curl_close"/>
<exclude name="WordPress.WP.AlternativeFunctions.curl_curl_setopt_array"/>
<exclude name="WordPress.CodeAnalysis.AssignmentInCondition">
<exclude-pattern>*/daos/*</exclude-pattern>
</exclude>
<!-- Exclude WordPress escaping functions -->
<exclude name="WordPress.XSS.EscapeOutput" />
<!-- Exclude the most controversial "accepted" rule -->
<exclude name="WordPress.PHP.YodaConditions" />
<!-- You need to exclude both of these rules because the parent rule will throw offenses for the child -->
<exclude name="WordPress.NamingConventions.ValidVariableName.NotSnakeCase"/>
<exclude name="WordPress.NamingConventions.ValidVariableName"/>
<!-- we directly use the pdo object, not everything goes through WordPress -->
<exclude name="WordPress.DB.RestrictedClasses.mysql__PDO"/>
<!-- While a good idea, we can't enforce this currently, especially because of how the API is coded -->
<exclude name="WordPress.PHP.StrictComparisons"/>
<exclude name="WordPress.PHP.StrictInArray"/>
<!-- hate disabling this rule concerning associative key => values being on new lines, but we have quite a few places where this rule would reduce readability (an associative array reference within an associative array value ) -->
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.AssociativeKeyFound"/>
<!-- TODO: remove/disable offending debugging code from GIOS API and remove these exclusions -->
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_error_log"/>
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_print_r"/>
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_var_dump"/>
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_trigger_error"/>
<!-- we shouldn't replace all occurrences of urlencode() with rawurlencode() until extensive testing establishes rawurlencode() and RFC3986 won't break any of our sites and applications. See http://php.net/manual/en/function.rawurlencode.php for details -->
<exclude name="WordPress.PHP.DiscouragedPHPFunctions.urlencode_urlencode"/>
<!-- importing wp_json_encode and replacing json_encode won't gain us anything or protect our usage of the function (against non-utf8 data) -->
<exclude name="WordPress.WP.AlternativeFunctions.json_encode_json_encode"/>
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
<!-- TODO: remove these exclusions as soon as we no longer use file_get_contents() -->
<exclude name="WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents"/>
<exclude name="WordPress.WP.AlternativeFunctions.file_system_read_file_get_contents"/>
</rule>
<!-- Strict class naming rules in Wordpress Core are unnecessary for us -->
<rule ref="WordPress.Files.FileName">
<properties>
<property name="strict_class_file_names" value="false" />
</properties>
</rule>
<!-- Braces on the same line -->
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie">
<property name="checkClosures" value="true" />
</rule>
<!-- Don't require short description in doc comments -->
<rule ref="Generic.Commenting.DocComment.MissingShort">
<property name="checkClosures" value="true" />
</rule>
<!-- TODO write a rule for opening brace must be on same line as class declaration -->
<!-- TODO write a rule for no empty lines after function declaration -->
<!-- TODO write a rule for no empty lines at end of function body -->
<!-- TODO sniff array spacing -->
<!-- TODO sniff array key values line up -->
<!-- Check for PHP cross-version compatibility. -->
<!--
To enable this, the PHPCompatibility standard needs
to be installed.
See the readme for installation instructions:
https://github.com/wimg/PHPCompatibility
-->
<config name="testVersion" value="7.0-"/>
<rule ref="PHPCompatibility"/>
<!--
To get the optimal benefits of using WPCS, we should add a couple of
custom properties.
Adjust the values of these properties to fit our needs.
For information on additional custom properties available, check out
the wiki:
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties
-->
<config name="minimum_supported_wp_version" value="7.0"/>
</ruleset>