-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathphpcs.xml
106 lines (95 loc) · 5.84 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
<?xml version="1.0"?>
<ruleset name="Packeta_OpenCart3">
<description>The Code Sniffer ruleset for Packeta module</description>
<arg name="extensions" value="php,inc" />
<arg name="report" value="full"/>
<arg name="colors"/>
<arg value="sp"/>
<config name="php_version" value="50640"/>
<autoload>./phpcs/vendor/autoload.php</autoload>
<!-- folders to be tested -->
<file>./upload/admin/model/extension/shipping</file>
<exclude-pattern>admin/model/extension/shipping/(?!*zasilkovna*)*$</exclude-pattern>
<file>./upload/system/library/Packetery</file>
<exclude-pattern>system/library/Packetery/deps/</exclude-pattern>
<!-- files to be tested -->
<file>./upload/admin/controller/extension/shipping/zasilkovna.php</file>
<file>./upload/catalog/controller/extension/module/zasilkovna.php</file>
<file>./upload/catalog/model/extension/shipping/zasilkovna.php</file>
<!-- language files to be tested -->
<file>./upload/catalog/language</file>
<exclude-pattern>catalog/language/(?!*zasilkovna*)*$</exclude-pattern>
<file>./upload/admin/language</file>
<exclude-pattern>admin/language/(?!*zasilkovna*)*$</exclude-pattern>
<!-- Sniffs themselves to be tested-->
<file>./phpcs/Packetery</file>
<!-- PSR2 standard -->
<rule ref="PSR2">
<!-- allow curly brace on same line as function declaration -->
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/>
<!-- allow method names with other than camel case -->
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
<!-- allow function names with other than camel case -->
<exclude name="Generic.NamingConventions.CamelCapsFunctionName.ScopeNotCamelCaps"/>
<!-- allow missing namespace in class declaration -->
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
<!-- allow curly brace on same line as class declaration -->
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine"/>
<!-- allow files with symbol declarations and side effects at the same time -->
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols"/>
</rule>
<rule ref="Squiz.Commenting.FunctionComment">
<!-- allow missing of scalar typehint, scalar typehint is not supported in PHP 5.6 -->
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing"/>
<!-- replaced by Packetery/Sniffs/Annotations/MethodAnnotationSniff -->
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/>
<!-- replaced by Packetery/Sniffs/Annotations/MethodAnnotationSniff -->
<exclude name="Squiz.Commenting.FunctionComment.MissingReturn"/>
<!-- allow unaligned parameter names in function comment -->
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType"/>
<!-- allow @throws without comment -->
<exclude name="Squiz.Commenting.FunctionComment.EmptyThrows"/>
<!-- don't require full stop in param comment -->
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"/>
<!-- don't require capital letter in param comment -->
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentNotCapital"/>
<!-- Don't require long version of type names in @param comment ex. boolean, integer -->
<exclude name="Squiz.Commenting.FunctionComment.IncorrectParamVarName"/>
<!-- Don't require long version of type names in @return comment ex. boolean, integer -->
<exclude name="Squiz.Commenting.FunctionComment.InvalidReturn"/>
</rule>
<!-- check for line length, but ignore rule in zasilkovna files in language folder -->
<rule ref="Generic.Files.LineLength.TooLong">
<exclude-pattern>*/language/*/zasilkovna*</exclude-pattern>
</rule>
<!-- don't allow opening function brace on new line -->
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine" />
<!-- don't allow opening class brace on new line -->
<rule ref="Generic.Classes.OpeningBraceSameLine.BraceOnNewLine" />
<!-- Rules taken from Slevomat coding standard -->
<!-- class properties should be separated by one blank line -->
<rule ref="./phpcs/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Classes/PropertySpacingSniff.php"/>
<!-- class methods should be separated by one blank line -->
<rule ref="./phpcs/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Classes/MethodSpacingSniff.php"/>
<!-- don't allow duplicate spaces unless in comments or annotations -->
<rule ref="./phpcs/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Whitespaces/DuplicateSpacesSniff.php">
<properties>
<property name="ignoreSpacesInAnnotation" value="true"/>
<property name="ignoreSpacesInComments" value="true"/>
</properties>
</rule>
<!-- Packeta custom rules -->
<!-- reports error when there is a TODO comment without description -->
<rule ref="./phpcs/Packetery/Sniffs/Generic/Commenting/EmptyTodoSniff.php"/>
<!-- reports error when there is a class property without annotation -->
<rule ref="./phpcs/Packetery/Sniffs/Annotations/PropertyAnnotationSniff.php"/>
<!-- reports error when there is a method without annotation for parameters or without @return -->
<rule ref="./phpcs/Packetery/Sniffs/Annotations/MethodAnnotationSniff.php"/>
<!-- reports and fixes error when there is no blank line before return statement -->
<rule ref="./phpcs/Packetery/Sniffs/Whitespace/BlankLineBeforeReturnSniff.php"/>
<!-- Other rules from original OC3 ruleset -->
<rule ref="./phpcs/OpenCart/ruleset.xml">
<!-- but allow inline if without brackets -->
<exclude name="Squiz.ControlStructures.InlineIfDeclaration.NoBrackets"/>
</rule>
</ruleset>