-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphpcs.xml.dist
187 lines (156 loc) · 7.53 KB
/
phpcs.xml.dist
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?xml version="1.0"?>
<ruleset name="Tiki Coding Standard">
<description>Tiki Coding Standard</description>
<!--
# Files and folders to check
-->
<!-- Paths to check -->
<file>.</file>
<!-- Exclude libraries and other folders that should not contain code -->
<!-- vendor folders -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/vendor_bundled/vendor/*</exclude-pattern>
<exclude-pattern>*/vendor_custom/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<!-- libraries bundled with tiki -->
<exclude-pattern>*/lib/dracula/*</exclude-pattern>
<exclude-pattern>*/lib/equation/*</exclude-pattern>
<exclude-pattern>*/lib/ical/*</exclude-pattern>
<exclude-pattern>*/lib/openlayers/*</exclude-pattern>
<exclude-pattern>*/lib/sheet/excel/*</exclude-pattern>
<exclude-pattern>*/lib/sheet/include/*</exclude-pattern>
<exclude-pattern>*/lib/sheet/ole.php</exclude-pattern>
<exclude-pattern>*/lib/sheet/ole/*</exclude-pattern>
<exclude-pattern>*/lib/soap/nusoap/*</exclude-pattern>
<exclude-pattern>*/lib/tar.class.php</exclude-pattern>
<exclude-pattern>*/lib/tikihelp/js/*</exclude-pattern>
<exclude-pattern>*/lib/tikihelp/menu/*</exclude-pattern>
<exclude-pattern>*/lib/webmail/mimeDecode.php</exclude-pattern>
<exclude-pattern>*/lib/webmail/net_pop3.php</exclude-pattern>
<!-- any dot file -->
<exclude-pattern>*/\.*/*</exclude-pattern>
<!-- generated files / directories -->
<exclude-pattern>*/lang/*/language.php</exclude-pattern>
<exclude-pattern>*/lang/*/language.js</exclude-pattern>
<exclude-pattern>*/lib/test/language/fixtures/language_*</exclude-pattern>
<exclude-pattern>*/public/generated/*</exclude-pattern>
<!-- local config files -->
<exclude-pattern>*/local.php</exclude-pattern>
<!-- other directories that should not contain core code -->
<!-- <exclude-pattern>*/doc/*</exclude-pattern> -->
<exclude-pattern>*/bin/*</exclude-pattern>
<exclude-pattern>*/img/*</exclude-pattern>
<exclude-pattern>*/storage/*</exclude-pattern>
<exclude-pattern>*/temp/*</exclude-pattern>
<!--
# Default arguments for phpcs
-->
<!-- display progress -->
<arg value="p"/>
<arg name="colors"/>
<arg name="extensions" value="php"/>
<!--
# Exceptions for Tiki - will be removed as we improve the code
#
# Using this process allow to allow specific violation of standards instead of ignoring
# blindly all the file, allowing to catch new violations in existing files.
-->
<rule ref="./doc/devtools/codesniffer/standards/TikiIgnore"/>
<!--
# Tiki specific rules
-->
<rule ref="./doc/devtools/codesniffer/standards/Tiki"/>
<!--
# Compatibility check with PHP versions supported
-->
<!-- Check for compatibility for PHP >= 8.1 -->
<config name="testVersion" value="8.1-"/>
<rule ref="PHPCompatibility"/>
<!-- ## Exceptions for compatibility check -->
<!-- Skip check compatibility for functions included as polyfill -->
<rule ref="PHPCompatibility">
<!-- polyfill-php82: https://github.com/symfony/polyfill-php82/tree/main/bootstrap.php and
https://github.com/symfony/polyfill-php82/tree/main/Resources/stubs -->
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.odbc_connection_string_is_quotedFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.odbc_connection_string_should_quoteFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.odbc_connection_string_quoteFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.ini_parse_quantityFound"/>
<exclude name="PHPCompatibility.Classes.NewClasses.random_brokenrandomengineerrorFound"/>
<exclude name="PHPCompatibility.Classes.NewClasses.random_randomerrorFound"/>
<exclude name="PHPCompatibility.Classes.NewClasses.random_randomexceptionFound"/>
<!-- polyfill-php83: https://github.com/symfony/polyfill-php83/tree/main/bootstrap.php and
https://github.com/symfony/polyfill-php83/tree/main/Resources/stubs -->
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.json_validateFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.mb_str_padFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.ldap_exop_syncFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.ldap_connect_walletFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.stream_context_set_optionsFound"/>
</rule>
<!--
# PHP Coding Standards
-->
<!-- Tiki uses the Zend Coding Standards
reference: https://github.com/zendframework/zend-coding-standard/blob/master/ruleset.xml -->
<rule ref="PSR12"/>
<!-- Other rules to enforce the ZF standards -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Generic.Formatting.SpaceAfterNot"/>
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="spacing" value="1"/>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<!-- Moved as override to the end of the rule set -->
<!--
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="false"/>
</properties>
</rule>
-->
<!-- ## Exceptions for coding standards -->
<!-- Tiki have some guard code in most of the files, leading to both declaring and executing code in the same file -->
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
<exclude-pattern>*.php</exclude-pattern>
</rule>
<!-- latest tiki-check.php may be used to test servers with a old version of php, so use long array syntax -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax">
<exclude-pattern>*/tiki-check.php</exclude-pattern>
</rule>
<rule ref="Generic.Arrays.DisallowShortArraySyntax">
<include-pattern>*/tiki-check.php</include-pattern>
</rule>
<!-- Cypth Integration requires specific naming, etc -->
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
<exclude-pattern>lib/cypht/integration/*</exclude-pattern>
<exclude-pattern>lib/cypht/modules/*</exclude-pattern>
</rule>
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
<exclude-pattern>lib/cypht/integration/*</exclude-pattern>
<exclude-pattern>lib/cypht/modules/*</exclude-pattern>
</rule>
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
<exclude-pattern>lib/cypht/modules/*</exclude-pattern>
</rule>
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<exclude-pattern>lib/cypht/integration/*</exclude-pattern>
</rule>
<!-- ## Mark some rules as warnings until tiki gets in a better shape -->
<!-- Change severity to be able to filter if too many lines over 120 using cli option warning-severity=5 -->
<rule ref="Generic.Files.LineLength">
<severity>4</severity>
</rule>
<!-- ## Overrides - at the end to make sure they are applied -->
<!-- From ZF Standards -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="false"/>
</properties>
</rule>
</ruleset>