-
Notifications
You must be signed in to change notification settings - Fork 2
/
phpcs.xml
147 lines (114 loc) · 5.57 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?xml version="1.0"?>
<ruleset name="Geniem">
<description>A custom set of rules to check styles for a Geniem WP projects</description>
<!-- Exclude wp core files -->
<exclude-pattern>/wp/wp-admin/*</exclude-pattern>
<exclude-pattern>/wp/wp-includes/*</exclude-pattern>
<exclude-pattern>/wp/wp-*.php</exclude-pattern>
<exclude-pattern>/wp/index.php</exclude-pattern>
<exclude-pattern>/wp/xmlrpc.php</exclude-pattern>
<exclude-pattern>/wp/</exclude-pattern>
<!-- This is from roots/bedrock and keep it as is -->
<exclude-pattern>/mu-plugins/bedrock-autoloader.php</exclude-pattern>
<!-- Exclude object cache -->
<exclude-pattern>/app/object-cache.php</exclude-pattern>
<!-- Exclude whoops debugger loaded by composer -->
<exclude-pattern>/mu-plugins/wps/*.php</exclude-pattern>
<!-- Tests might have unusual notations which we can't check -->
<exclude-pattern>/tests/</exclude-pattern>
<!-- Skip seed data -->
<exclude-pattern>/data/</exclude-pattern>
<!-- Don't check composer dependencies -->
<exclude-pattern>/vendor/</exclude-pattern>
<!-- Skip phinx seeds/migrations -->
<exclude-pattern>db/seeds/</exclude-pattern>
<exclude-pattern>db/migrations/</exclude-pattern>
<!--
Skip our custom wordpress install.php drop-in.
This contains sql queries from the basic wp example and for good reason.
-->
<exclude-pattern>app/install.php</exclude-pattern>
<!-- There MUST NOT be more than one statement per line. -->
<!-- Disallow tabs altogether -->
<rule ref="Generic.WhiteSpace.DisallowTabIndent.TabsUsed"/>
<!-- Use 4 spaces for indentation -->
<arg name="tab-width" value="4"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
</properties>
</rule>
<!--
The soft limit on line length MUST be 100 characters
automated style checkers MUST warn but MUST NOT error at the soft limit.
-->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="100"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
</rule>
<!-- All PHP files MUST use the Unix LF (linefeed) line ending. -->
<rule ref="Generic.Files.LineEndings">
<properties>
<property name="eolChar" value="\n"/>
</properties>
</rule>
<!-- Method arguments with default values MUST go at the end of the argument list. -->
<rule ref="PEAR.Functions.ValidDefaultValue"/>
<!-- This means almost always that developer used an ugly hotfix -->
<rule ref="Squiz.PHP.CommentedOutCode"/>
<!-- Don't allow random whitespacing into multiple lines-->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
<!-- Don't put unused function parameters into function definition -->
<!-- This might be problematic when using wp actions/filters -->
<!-- This is mostly useful, We should give warning instead -->
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
<!-- No TODO comments, open issues in github/gogs/gitlab instead -->
<rule ref="Generic.Commenting.Todo"/>
<!-- Don't allow oneliner ifs without brackets {} -->
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<!-- No spaces before comma in function calls -->
<!-- This might be problematic when using wp actions/filters -->
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma"/>
<!--
Ending tags '?>' can be really painful to debug.
Just disallow them in the end of the file
-->
<rule ref="PSR2.Files.ClosingTag.NotAllowed"/>
<!-- <?php tags and constants (true,false,null) need to be lowercase -->
<rule ref="Generic.PHP.LowerCaseKeyword"/>
<rule ref="Generic.PHP.LowerCaseConstant"/>
<!-- Include WordPress Coding Standards with few exclusions -->
<rule ref="WordPress">
<!--
We may want a middle ground though. The best way to do this is add the
entire ruleset, then rule by rule, remove ones that don't suit a project. We
can do this by running `phpcs` with the '-s' flag, to see the names of the
different Sniffs, as their rules are broken. From here, we can opt to
exclude problematic sniffs like so.
-->
<!--
These are nice but don't have any idea of context
For example we have globals which are not user defined
-->
<exclude name="WordPress.VIP.ValidatedSanitizedInput.MissingUnslash" />
<exclude name="WordPress.VIP.ValidatedSanitizedInput.InputNotSanitized" />
<!-- This project doesnt use wordpress.com functions -->
<exclude name="WordPress.VIP.RestrictedFunctions.get_term_link" />
<!-- Exclude indentation rules and use PEAR.WhiteSpace.ScopeIndent instead -->
<exclude name="Generic.WhiteSpace.ScopeIndent" />
<!-- Use spaces instead of tabs -->
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
<!-- Package Tag seems unimportant in wordpress plugins? -->
<exclude name="Squiz.Commenting.FileComment.MissingPackageTag" />
<!--
This forces you to put '.' in oneline comments.
Maybe full sentences are better than comments with 1-2 words
But we don't want to discourage people from usen even a small comments
-->
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
<!-- Welcome to the dark side -->
<exclude name="WordPress.PHP.YodaConditions" />
</rule>
</ruleset>