xref: /dokuwiki/_test/phpcs.xml (revision 6225b270e09ba8d1cb10e70c9cbdbd0fe690c253)
1994e9d4eSAndreas Gohr<?xml version="1.0"?>
2994e9d4eSAndreas Gohr<ruleset name="DokuWiki Coding Standard Standard" namespace="DokuWiki\CS\Standard">
3994e9d4eSAndreas Gohr    <description>Coding Standard used for DokuWiki</description>
499c1e5dfSAndreas Gohr
599c1e5dfSAndreas Gohr    <!-- default config -->
699c1e5dfSAndreas Gohr    <arg name="colors"/>
799c1e5dfSAndreas Gohr    <arg value="sp"/>
899c1e5dfSAndreas Gohr    <arg name="extensions" value="php"/>
999c1e5dfSAndreas Gohr
10b196d8deSAndreas Gohr    <ini name="memory_limit" value="-1"/>
11b196d8deSAndreas Gohr
1299c1e5dfSAndreas Gohr    <!-- where to look -->
13994e9d4eSAndreas Gohr    <file>../inc</file>
14994e9d4eSAndreas Gohr    <file>../lib</file>
15994e9d4eSAndreas Gohr    <file>../bin</file>
16994e9d4eSAndreas Gohr    <file>../doku.php</file>
17994e9d4eSAndreas Gohr    <file>../index.php</file>
18994e9d4eSAndreas Gohr    <file>../feed.php</file>
19994e9d4eSAndreas Gohr    <file>../install.php</file>
2099c1e5dfSAndreas Gohr
2199c1e5dfSAndreas Gohr    <!-- skip these completely -->
22994e9d4eSAndreas Gohr    <exclude-pattern>*/lang/*/lang.php</exclude-pattern>
23994e9d4eSAndreas Gohr    <exclude-pattern>*/lang/*/settings.php</exclude-pattern>
24994e9d4eSAndreas Gohr    <exclude-pattern>*/_test/*</exclude-pattern>
2599c1e5dfSAndreas Gohr
2699c1e5dfSAndreas Gohr    <!-- 3rd party libs, these should be moved to composer some day -->
2799c1e5dfSAndreas Gohr    <exclude-pattern>*/inc/DifferenceEngine.php</exclude-pattern>
2899c1e5dfSAndreas Gohr    <exclude-pattern>*/inc/IXR_Library.php</exclude-pattern>
2999c1e5dfSAndreas Gohr    <exclude-pattern>*/inc/JSON.php</exclude-pattern>
3099c1e5dfSAndreas Gohr    <exclude-pattern>*/inc/JpegMeta.php</exclude-pattern>
3109d57d5aSAndreas Gohr    <exclude-pattern>*/lib/plugins/authad/adLDAP</exclude-pattern>
3299c1e5dfSAndreas Gohr
33dd8af038SAndreas Gohr    <!-- deprecated files to be removed soon -->
34dd8af038SAndreas Gohr    <exclude-pattern>*/inc/cli.php</exclude-pattern>
3527f63a23SAndreas Gohr    <exclude-pattern>*/inc/parser/*</exclude-pattern>
36dd8af038SAndreas Gohr
37994e9d4eSAndreas Gohr    <!-- rules on top of PSR-2 -->
38994e9d4eSAndreas Gohr    <rule ref="PSR2">
39994e9d4eSAndreas Gohr        <!-- the following rule is not in PSR-2 and breaks the guardian pattern -->
40994e9d4eSAndreas Gohr        <exclude name="Generic.ControlStructures.InlineControlStructure.NotAllowed"/>
414b3d1701SAndreas Gohr
424b3d1701SAndreas Gohr        <!-- we have lots of legacy classes without name spaces -->
434b3d1701SAndreas Gohr        <exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
44e3cafdc2SMichael Große
45e3cafdc2SMichael Große        <!-- Rules with automatic fixes that we want to adhere to, but currently don't -->
46e3cafdc2SMichael Große        <exclude name="Generic.Formatting.DisallowMultipleStatements.SameLine"/>
47e3cafdc2SMichael Große        <exclude name="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma"/>
48e3cafdc2SMichael Große        <exclude name="Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma"/>
49e3cafdc2SMichael Große        <exclude name="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma"/>
50e3cafdc2SMichael Große        <exclude name="Generic.PHP.LowerCaseKeyword.Found"/>
51e3cafdc2SMichael Große        <exclude name="Generic.PHP.LowerCaseConstant.Found"/>
52e3cafdc2SMichael Große        <exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact"/>
53e3cafdc2SMichael Große        <exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect"/>
54e3cafdc2SMichael Große        <exclude name="Generic.WhiteSpace.IncrementDecrementSpacing.SpaceAfterDecrement"/>
55e3cafdc2SMichael Große        <exclude name="Generic.WhiteSpace.IncrementDecrementSpacing.SpaceAfterIncrement"/>
56e3cafdc2SMichael Große
57e3cafdc2SMichael Große        <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis"/>
58e3cafdc2SMichael Große        <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword"/>
59e3cafdc2SMichael Große        <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace"/>
60e3cafdc2SMichael Große        <exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace"/>
61e3cafdc2SMichael Große        <exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.NoSpaceBeforeArrow"/>
62e3cafdc2SMichael Große        <exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.NoSpaceAfterArrow"/>
63e3cafdc2SMichael Große        <exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.SpacingBeforeAs"/>
64e3cafdc2SMichael Große        <exclude name="Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterSecond"/>
65e3cafdc2SMichael Große        <exclude name="Squiz.ControlStructures.ForLoopDeclaration.NoSpaceAfterSecond"/>
66e3cafdc2SMichael Große        <exclude name="Squiz.ControlStructures.ForLoopDeclaration.NoSpaceAfterFirst"/>
67e3cafdc2SMichael Große        <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.NoSpaceBeforeArg"/>
68e3cafdc2SMichael Große        <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceAfterEquals"/>
69e3cafdc2SMichael Große        <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterReference"/>
70e3cafdc2SMichael Große        <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose"/>
71e3cafdc2SMichael Große        <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceBeforeEquals"/>
72e3cafdc2SMichael Große        <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/>
73e3cafdc2SMichael Große        <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.NewlineBeforeOpenBrace"/>
74e3cafdc2SMichael Große        <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.CloseBracketLine"/>
75e3cafdc2SMichael Große        <exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen"/>
76e3cafdc2SMichael Große        <exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/>
77e3cafdc2SMichael Große        <exclude name="Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore"/>
78e3cafdc2SMichael Große        <exclude name="Squiz.WhiteSpace.ScopeClosingBrace.Indent"/>
79e3cafdc2SMichael Große        <exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine"/>
80e3cafdc2SMichael Große
81e3cafdc2SMichael Große        <exclude name="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody"/>
82e3cafdc2SMichael Große        <exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine"/>
83e3cafdc2SMichael Große        <exclude name="PSR2.Classes.PropertyDeclaration.StaticBeforeVisibility"/>
84e3cafdc2SMichael Große        <exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/>
85e3cafdc2SMichael Große        <exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpaceBeforeCloseBrace"/>
86e3cafdc2SMichael Große        <exclude name="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed"/>
87e3cafdc2SMichael Große        <exclude name="PSR2.ControlStructures.SwitchDeclaration.BreakIndent"/>
88e3cafdc2SMichael Große        <exclude name="PSR2.ControlStructures.SwitchDeclaration.BreakNotNewLine"/>
89e3cafdc2SMichael Große        <exclude name="PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE"/>
90e3cafdc2SMichael Große        <exclude name="PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonDEFAULT"/>
91e3cafdc2SMichael Große        <exclude name="PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonCASE"/>
92e3cafdc2SMichael Große        <exclude name="PSR2.Files.EndFileNewline.TooMany"/>
93e3cafdc2SMichael Große        <exclude name="PSR2.Files.EndFileNewline.NoneFound"/>
94e3cafdc2SMichael Große        <exclude name="PSR2.Methods.FunctionCallSignature.Indent"/>
95e3cafdc2SMichael Große        <exclude name="PSR2.Methods.FunctionCallSignature.EmptyLine"/>
96e3cafdc2SMichael Große        <exclude name="PSR2.Methods.FunctionCallSignature.ContentAfterOpenBracket"/>
97e3cafdc2SMichael Große        <exclude name="PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket"/>
98e3cafdc2SMichael Große        <exclude name="PSR2.Methods.FunctionCallSignature.CloseBracketLine"/>
99e3cafdc2SMichael Große        <exclude name="PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket"/>
100e3cafdc2SMichael Große        <exclude name="PSR2.Methods.FunctionCallSignature.SpaceAfterOpenBracket"/>
101e3cafdc2SMichael Große        <exclude name="PSR2.Methods.FunctionCallSignature.MultipleArguments"/>
102e3cafdc2SMichael Große        <exclude name="PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose"/>
103e3cafdc2SMichael Große        <exclude name="PSR2.Methods.MethodDeclaration.StaticBeforeVisibility"/>
104e3cafdc2SMichael Große        <exclude name="PSR2.Namespaces.NamespaceDeclaration.BlankLineAfter"/>
105e3cafdc2SMichael Große        <exclude name="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse"/>
106994e9d4eSAndreas Gohr    </rule>
10799c1e5dfSAndreas Gohr
10899c1e5dfSAndreas Gohr    <!-- disable some rules for certain paths, for legacy support -->
10999c1e5dfSAndreas Gohr    <rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
11099c1e5dfSAndreas Gohr        <exclude-pattern>*/inc/Plugin.php</exclude-pattern>
11199c1e5dfSAndreas Gohr        <exclude-pattern>*/inc/PluginInterface.php</exclude-pattern>
112dd8af038SAndreas Gohr        <exclude-pattern>*/inc/PluginTrait.php</exclude-pattern>
113e79ce394SAndreas Gohr
11482f7cb05SAndreas Gohr        <exclude-pattern>*/lib/plugins/*.php</exclude-pattern>
11599c1e5dfSAndreas Gohr        <exclude-pattern>*/lib/plugins/*/action.php</exclude-pattern>
116e79ce394SAndreas Gohr        <exclude-pattern>*/lib/plugins/*/action/*.php</exclude-pattern>
11799c1e5dfSAndreas Gohr        <exclude-pattern>*/lib/plugins/*/admin.php</exclude-pattern>
118e79ce394SAndreas Gohr        <exclude-pattern>*/lib/plugins/*/admin/*.php</exclude-pattern>
11999c1e5dfSAndreas Gohr        <exclude-pattern>*/lib/plugins/*/auth.php</exclude-pattern>
120e79ce394SAndreas Gohr        <exclude-pattern>*/lib/plugins/*/auth/*.php</exclude-pattern>
12199c1e5dfSAndreas Gohr        <exclude-pattern>*/lib/plugins/*/cli.php</exclude-pattern>
122e79ce394SAndreas Gohr        <exclude-pattern>*/lib/plugins/*/cli/*.php</exclude-pattern>
123e79ce394SAndreas Gohr        <exclude-pattern>*/lib/plugins/*/helper.php</exclude-pattern>
124e79ce394SAndreas Gohr        <exclude-pattern>*/lib/plugins/*/helper/*.php</exclude-pattern>
12599c1e5dfSAndreas Gohr        <exclude-pattern>*/lib/plugins/*/remote.php</exclude-pattern>
126e79ce394SAndreas Gohr        <exclude-pattern>*/lib/plugins/*/remote/*.php</exclude-pattern>
12799c1e5dfSAndreas Gohr        <exclude-pattern>*/lib/plugins/*/syntax.php</exclude-pattern>
128e79ce394SAndreas Gohr        <exclude-pattern>*/lib/plugins/*/syntax/*.php</exclude-pattern>
12999c1e5dfSAndreas Gohr    </rule>
13082f7cb05SAndreas Gohr
13182f7cb05SAndreas Gohr    <!-- underscore skips exposing public methods to remote api -->
13282f7cb05SAndreas Gohr    <rule ref="PSR2.Methods.MethodDeclaration.Underscore">
1331dce0478SAndreas Gohr        <exclude-pattern>*/inc/Extension/RemotePlugin.php</exclude-pattern>
13482f7cb05SAndreas Gohr        <exclude-pattern>*/lib/plugins/*/remote.php</exclude-pattern>
13582f7cb05SAndreas Gohr        <exclude-pattern>*/lib/plugins/*/remote/*.php</exclude-pattern>
13682f7cb05SAndreas Gohr    </rule>
13782f7cb05SAndreas Gohr
13899c1e5dfSAndreas Gohr    <rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
1391dce0478SAndreas Gohr        <exclude-pattern>*/inc/Extension/PluginInterface.php</exclude-pattern>
1401dce0478SAndreas Gohr        <exclude-pattern>*/inc/Extension/PluginTrait.php</exclude-pattern>
14199c1e5dfSAndreas Gohr    </rule>
14299c1e5dfSAndreas Gohr
14327f63a23SAndreas Gohr    <!-- for now we mix declarations and execution here (mostly for defines) -->
1442b2d0ba9SAndreas Gohr    <rule ref="PSR1.Files.SideEffects">
14527f63a23SAndreas Gohr        <exclude-pattern>*/index.php</exclude-pattern>
14627f63a23SAndreas Gohr        <exclude-pattern>*/inc/parserutils.php</exclude-pattern>
14727f63a23SAndreas Gohr        <exclude-pattern>*/inc/mail.php</exclude-pattern>
14827f63a23SAndreas Gohr        <exclude-pattern>*/inc/init.php</exclude-pattern>
149cc8fc761SMichael Große        <exclude-pattern>*/inc/farm.php</exclude-pattern>
15027f63a23SAndreas Gohr        <exclude-pattern>*/inc/fulltext.php</exclude-pattern>
151cc8fc761SMichael Große        <exclude-pattern>*/inc/pluginutils.php</exclude-pattern>
152*6225b270SMichael Große        <exclude-pattern>*/inc/indexer.php</exclude-pattern>
15327f63a23SAndreas Gohr        <exclude-pattern>*/inc/Mailer.class.php</exclude-pattern>
1541a953a5bSAndreas Gohr        <exclude-pattern>*/doku.php</exclude-pattern>
1551a953a5bSAndreas Gohr        <exclude-pattern>*/install.php</exclude-pattern>
1560da4ba1bSAndreas Gohr        <exclude-pattern>*/inc/utf8.php</exclude-pattern>
1571a953a5bSAndreas Gohr        <exclude-pattern>*/feed.php</exclude-pattern>
158f4251554SAndreas Gohr        <exclude-pattern>*/inc/load.php</exclude-pattern>
1592b2d0ba9SAndreas Gohr        <exclude-pattern>*/bin/*.php</exclude-pattern>
160b78f68bcSAndreas Gohr        <exclude-pattern>*/lib/exe/*.php</exclude-pattern>
1612b2d0ba9SAndreas Gohr    </rule>
1622b2d0ba9SAndreas Gohr
163994e9d4eSAndreas Gohr</ruleset>
164