-
Notifications
You must be signed in to change notification settings - Fork 7
/
phpcs.xml
166 lines (141 loc) · 7.23 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?xml version="1.0"?>
<ruleset name="MultiSafepayOpenCart">
<description>A custom coding standard for OpenCart extensions.</description>
<exclude-pattern>*/bin/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/src/system/library/multisafepay/*</exclude-pattern>
<exclude-pattern>*/src/image/*</exclude-pattern>
<!-- Exclude: PHPUnit tests files -->
<exclude-pattern>*/src/system/config/*</exclude-pattern>
<exclude-pattern>*/src/system/library/session/*</exclude-pattern>
<exclude-pattern>*/src/admin/controller/startup/*</exclude-pattern>
<exclude-pattern>*/src/admin/view/javascript/multisafepay/dragula.js</exclude-pattern>
<exclude-pattern>*/src/catalog/controller/startup/test_startup.php</exclude-pattern>
<exclude-pattern>*/src/catalog/view/javascript/multisafepay/select2.min.js</exclude-pattern>
<exclude-pattern>*/src/catalog/view/theme/default/stylesheet/multisafepay/select2.min.css</exclude-pattern>
<config name="installed_paths" value="src/system/library/multisafepay/vendor/object-calisthenics/phpcs-calisthenics-rules/src/ObjectCalisthenics"/>
<!-- Rule 1: Only X indentation level per function/method (with default values) -->
<rule ref="ObjectCalisthenics.Metrics.MaxNestingLevel">
<properties>
<!-- goal is 2 -->
<property name="maxNestingLevel" value="2"/>
</properties>
</rule>
<!-- Rule 2: There is no "else" -->
<rule ref="ObjectCalisthenics.ControlStructures.NoElse"/>
<!-- Rule 3: Only one object operator (->) per line (with default values) -->
<rule ref="ObjectCalisthenics.CodeAnalysis.OneObjectOperatorPerLine">
<properties>
<property name="variablesHoldingAFluentInterface" type="array" value="$queryBuilder,$containerBuilder"/>
<property name="methodsStartingAFluentInterface" type="array" value="createQueryBuilder"/>
<property name="methodsEndingAFluentInterface" type="array" value="execute,getQuery"/>
</properties>
</rule>
<!-- Rule 4: Do not abbreviate (with default values) -->
<rule ref="ObjectCalisthenics.NamingConventions.ElementNameMinimalLength">
<exclude-pattern>*/src/*/language/*/extension/payment/multisafepay.php</exclude-pattern>
<exclude-pattern>*/src/*/language/*/payment/multisafepay.php</exclude-pattern>
<properties>
<property name="minLength" value="3"/>
<property name="allowedShortNames" type="array" value="i,id,to,up"/>
</properties>
</rule>
<!-- Rule 5: Keep your classes small (with default values) -->
<rule ref="ObjectCalisthenics.Files.ClassTraitAndInterfaceLength">
<exclude-pattern>*/src/system/library/multisafepay.php</exclude-pattern>
<exclude-pattern>*/src/catalog/controller/extension/payment/multisafepay.php</exclude-pattern>
<exclude-pattern>*/src/catalog/controller/payment/multisafepay.php</exclude-pattern>
<properties>
<!-- goal is 1100 -->
<property name="maxLength" value="1100"/>
</properties>
</rule>
<rule ref="ObjectCalisthenics.Files.FunctionLength">
<properties>
<!-- goal is 550 -->
<property name="maxLength" value="550"/>
</properties>
</rule>
<rule ref="ObjectCalisthenics.Metrics.PropertyPerClassLimit">
<properties>
<!-- goal is 14 -->
<property name="maxCount" value="14"/>
</properties>
</rule>
<rule ref="ObjectCalisthenics.Metrics.MethodPerClassLimit">
<exclude-pattern>*/src/system/library/multisafepay.php</exclude-pattern>
<properties>
<!-- goal is 85 -->
<property name="maxCount" value="85"/>
</properties>
</rule>
<!-- Rule 6: Do not Use Getters and Setters -->
<rule ref="ObjectCalisthenics.Classes.ForbiddenPublicProperty"/>
<rule ref="ObjectCalisthenics.NamingConventions.NoSetter"/>
<!-- Rule 7: Allow public properties -->
<rule ref="ObjectCalisthenics.Classes.ForbiddenPublicProperty">
<exclude name="ObjectCalisthenics.Classes.ForbiddenPublicProperty"/>
</rule>
<!-- Rule 8: Closing PHP tags are not allowed -->
<rule ref="Zend.Files.ClosingTag">
<severity>5</severity>
<type>error</type>
</rule>
<!-- Rule 9: Test the blank spaces in inline declarations -->
<rule ref="Squiz.ControlStructures.InlineIfDeclaration" />
<!-- Rule 10: Check for whitespace after lines of code and checks for spaces/indents on empty lines -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<severity>1</severity>
<type>warning</type>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile" />
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile" />
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" />
<!-- Rule 11: Check to ensure no PHP deprecated functions have been used -->
<rule ref="Generic.PHP.DeprecatedFunctions">
<severity>5</severity>
<type>error</type>
</rule>
<!-- Rule 12: PHP opening tag must be full <?php, no shorthand or ASP tags -->
<rule ref="Generic.PHP.DisallowShortOpenTag">
<severity>5</severity>
<type>error</type>
</rule>
<!-- Rule 13: In PHP files make sure there is no character before the opening tag -->
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
<!-- Rule 14: true, false, null etc. should all be lowercase only -->
<rule ref="Generic.PHP.LowerCaseConstant" />
<!-- Rule 15: Type casting should be immediately followed by the variable, no space -->
<rule ref="Generic.Formatting.NoSpaceAfterCast" />
<!-- Rule 16: Pass by reference is now only supported in the method/function params -->
<rule ref="Generic.Functions.CallTimePassByReference" />
<!-- Rule 17: keep the spacing between function/method params space after comma -->
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
<!-- Rule 18: method names should always be camel case -->
<rule ref="Generic.NamingConventions.CamelCapsFunctionName"/>
<!-- Rule 19: constants should always be uppercase -->
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<!-- Rule 20: Detect BOMs to avoid corruptions -->
<rule ref="Generic.Files.ByteOrderMark"/>
<!-- Rule 21: To do comments should be reported and completed -->
<rule ref="Generic.Commenting.Todo.CommentFound"/>
<!-- Rule 22: Fix me comments should be reported and fixed -->
<rule ref="Generic.Commenting.Fixme.CommentFound"/>
<!-- Rule 23: Check that line endings are only \n -->
<rule ref="Generic.Files.LineEndings">
<properties>
<property name="eolChar" value="\n"/>
</properties>
</rule>
<!-- Rule 24: Check that line endings are only \n -->
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent">
<exclude-pattern>*.tpl</exclude-pattern>
<exclude-pattern>*.twig</exclude-pattern>
<exclude-pattern>*.css</exclude-pattern>
<exclude-pattern>*.html</exclude-pattern>
<exclude-pattern>*.ini</exclude-pattern>
<exclude-pattern>*.txt</exclude-pattern>
<severity>1</severity>
<type>warning</type>
</rule>
</ruleset>