xref: /dokuwiki/_test/phpcs.xml (revision 504c13e8df88563c11b3720b317991bc38835a35)
1<?xml version="1.0"?>
2<ruleset name="DokuWiki Coding Standard Standard" namespace="DokuWiki\CS\Standard">
3    <description>Coding Standard used for DokuWiki</description>
4
5    <!-- default config -->
6    <arg name="colors"/>
7    <arg value="sp"/>
8    <arg name="extensions" value="php"/>
9
10    <ini name="memory_limit" value="-1"/>
11
12    <!-- where to look -->
13    <file>../inc</file>
14    <file>../lib</file>
15    <file>../bin</file>
16    <file>../doku.php</file>
17    <file>../index.php</file>
18    <file>../feed.php</file>
19    <file>../install.php</file>
20
21    <!-- skip these completely -->
22    <exclude-pattern>*/lang/*/lang.php</exclude-pattern>
23    <exclude-pattern>*/lang/*/settings.php</exclude-pattern>
24    <exclude-pattern>*/_test/*</exclude-pattern>
25    <exclude-pattern>*/vendor/*</exclude-pattern>
26
27    <!-- 3rd party libs, these should be moved to composer some day -->
28    <exclude-pattern>*/inc/DifferenceEngine.php</exclude-pattern>
29    <exclude-pattern>*/inc/JpegMeta.php</exclude-pattern>
30    <exclude-pattern>*/lib/plugins/authad/adLDAP</exclude-pattern>
31
32    <!-- rules on top of PSR-12 -->
33    <rule ref="PSR12">
34        <!-- This rule breaks the single line guard pattern that we prefer to keep using -->
35        <exclude name="Generic.ControlStructures.InlineControlStructure.NotAllowed"/>
36
37        <!-- we have lots of legacy classes without name spaces -->
38        <exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
39    </rule>
40
41    <!-- disable some rules for certain paths, for legacy support -->
42    <rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
43        <exclude-pattern>*/inc/Plugin.php</exclude-pattern>
44        <exclude-pattern>*/inc/PluginInterface.php</exclude-pattern>
45        <exclude-pattern>*/inc/PluginTrait.php</exclude-pattern>
46
47        <exclude-pattern>*/lib/plugins/*.php</exclude-pattern>
48        <exclude-pattern>*/lib/plugins/*/action.php</exclude-pattern>
49        <exclude-pattern>*/lib/plugins/*/action/*.php</exclude-pattern>
50        <exclude-pattern>*/lib/plugins/*/admin.php</exclude-pattern>
51        <exclude-pattern>*/lib/plugins/*/admin/*.php</exclude-pattern>
52        <exclude-pattern>*/lib/plugins/*/auth.php</exclude-pattern>
53        <exclude-pattern>*/lib/plugins/*/auth/*.php</exclude-pattern>
54        <exclude-pattern>*/lib/plugins/*/cli.php</exclude-pattern>
55        <exclude-pattern>*/lib/plugins/*/cli/*.php</exclude-pattern>
56        <exclude-pattern>*/lib/plugins/*/helper.php</exclude-pattern>
57        <exclude-pattern>*/lib/plugins/*/helper/*.php</exclude-pattern>
58        <exclude-pattern>*/lib/plugins/*/remote.php</exclude-pattern>
59        <exclude-pattern>*/lib/plugins/*/remote/*.php</exclude-pattern>
60        <exclude-pattern>*/lib/plugins/*/syntax.php</exclude-pattern>
61        <exclude-pattern>*/lib/plugins/*/syntax/*.php</exclude-pattern>
62
63        <exclude-pattern>*/inc/parser/*</exclude-pattern>
64    </rule>
65
66    <!-- underscore skips exposing public methods to remote api -->
67    <rule ref="PSR2.Methods.MethodDeclaration.Underscore">
68        <exclude-pattern>*/inc/Extension/RemotePlugin.php</exclude-pattern>
69        <exclude-pattern>*/lib/plugins/*/remote.php</exclude-pattern>
70        <exclude-pattern>*/lib/plugins/*/remote/*.php</exclude-pattern>
71
72        <exclude-pattern>*/inc/parser/*</exclude-pattern>
73    </rule>
74
75    <rule ref="PSR2.Classes.PropertyDeclaration.Underscore">
76        <exclude-pattern>*/inc/parser/*</exclude-pattern>
77    </rule>
78
79    <rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
80        <exclude-pattern>*/inc/Extension/PluginInterface.php</exclude-pattern>
81        <exclude-pattern>*/inc/Extension/PluginTrait.php</exclude-pattern>
82        <exclude-pattern>*/inc/parser/*</exclude-pattern>
83        <exclude-pattern>*/lib/plugins/*/renderer.php</exclude-pattern>
84        <exclude-pattern>*/lib/plugins/*/renderer/*.php</exclude-pattern>
85    </rule>
86</ruleset>
87