xref: /dokuwiki/_test/phpcs.xml (revision c6639e6a6a4b11d65ecbc19f1bbbf2d9b32d0c19)
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    <!-- where to look -->
11    <file>../inc</file>
12    <file>../lib</file>
13    <file>../bin</file>
14    <file>../doku.php</file>
15    <file>../index.php</file>
16    <file>../feed.php</file>
17    <file>../install.php</file>
18
19    <!-- skip these completely -->
20    <exclude-pattern>*/lang/*/lang.php</exclude-pattern>
21    <exclude-pattern>*/lang/*/settings.php</exclude-pattern>
22    <exclude-pattern>*/_test/*</exclude-pattern>
23
24    <!-- 3rd party libs, these should be moved to composer some day -->
25    <exclude-pattern>*/inc/DifferenceEngine.php</exclude-pattern>
26    <exclude-pattern>*/inc/IXR_Library.php</exclude-pattern>
27    <exclude-pattern>*/inc/JSON.php</exclude-pattern>
28    <exclude-pattern>*/inc/JpegMeta.php</exclude-pattern>
29    <exclude-pattern>*/lib/plugins/authad/adLDAP</exclude-pattern>
30
31    <!-- rules on top of PSR-2 -->
32    <rule ref="PSR2">
33        <!-- the following rule is not in PSR-2 and breaks the guardian pattern -->
34        <exclude name="Generic.ControlStructures.InlineControlStructure.NotAllowed"/>
35
36        <!-- we have lots of legacy classes without name spaces -->
37        <exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
38    </rule>
39
40    <!-- disable some rules for certain paths, for legacy support -->
41    <rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
42        <exclude-pattern>*/inc/parser/*</exclude-pattern>
43
44        <exclude-pattern>*/inc/Plugin.php</exclude-pattern>
45        <exclude-pattern>*/inc/PluginInterface.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    </rule>
63
64    <!-- underscore skips exposing public methods to remote api -->
65    <rule ref="PSR2.Methods.MethodDeclaration.Underscore">
66        <exclude-pattern>*/lib/plugins/remote.php</exclude-pattern>
67        <exclude-pattern>*/lib/plugins/*/remote.php</exclude-pattern>
68        <exclude-pattern>*/lib/plugins/*/remote/*.php</exclude-pattern>
69    </rule>
70
71    <rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
72        <exclude-pattern>*/inc/parser/*</exclude-pattern>
73    </rule>
74
75</ruleset>
76