forked from libreform/wp-libre-form
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpcs.xml
136 lines (105 loc) · 4.91 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
<?xml version="1.0"?>
<ruleset name="anttiviljami-wordpress">
<description>For nicer WordPress and PHP development</description>
<!-- Files and directories to parse -->
<file>./classes/</file>
<file>./inc/</file>
<file>./wp-libre-form.php</file>
<!-- Excluded directories and files -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/lang/*</exclude-pattern>
<exclude-pattern>*/assets/*</exclude-pattern>
<!-- Disallow tabs altogether -->
<rule ref="Generic.WhiteSpace.DisallowTabIndent.TabsUsed"/>
<!-- Use 2 spaces for indentation -->
<arg name="tab-width" value="2"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="2"/>
</properties>
</rule>
<!--
The soft limit on line length MUST be 120 characters
automated style checkers MUST warn but MUST NOT error at the soft limit.
-->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="120"/>
<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.
-->
<!-- Not for WordPress VIP -->
<exclude name="WordPress.VIP" />
<!-- 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" />
<!-- Free-form commenting rules -->
<exclude name="Squiz.Commenting" />
<!--
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" />
<!-- <?php doesn't have to be on its own line -->
<exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeEnd" />
<exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterOpen" />
<!-- Squiz.PHP.EmbeddedPhp.ContentBeforeEnd -->
<exclude name="Generic.ControlStructures.InlineControlStructure.NotAllowed" />
<!-- These indentation rules are just wrong :) -->
<exclude name="PEAR.Functions.FunctionCallSignature.Indent" />
<!-- Welcome to the dark side -->
<exclude name="WordPress.PHP.YodaConditions" />
<!-- We don't use nonce verification in this plugin -->
<exclude name="WordPress.CSRF.NonceVerification.NoNonceVerification" />
<!-- We like assignments in if -->
<exclude name="Squiz.PHP.DisallowMultipleAssignments.Found" />
<!-- Our hooks use dashes, not underscores -->
<exclude name="WordPress.NamingConventions.ValidHookName.UseUnderscores" />
<!-- This would be nice to enforce, but plugin main file shouldn't be called class-something -->
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<!-- This one is just weird. -->
<exclude name="WordPress.Arrays.ArrayIndentation" />
</rule>
</ruleset>