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"/> 44*e3cafdc2SMichael Große 45*e3cafdc2SMichael Große <!-- Rules with automatic fixes that we want to adhere to, but currently don't --> 46*e3cafdc2SMichael Große <exclude name="Generic.Formatting.DisallowMultipleStatements.SameLine"/> 47*e3cafdc2SMichael Große <exclude name="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma"/> 48*e3cafdc2SMichael Große <exclude name="Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma"/> 49*e3cafdc2SMichael Große <exclude name="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma"/> 50*e3cafdc2SMichael Große <exclude name="Generic.PHP.LowerCaseKeyword.Found"/> 51*e3cafdc2SMichael Große <exclude name="Generic.PHP.LowerCaseConstant.Found"/> 52*e3cafdc2SMichael Große <exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact"/> 53*e3cafdc2SMichael Große <exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect"/> 54*e3cafdc2SMichael Große <exclude name="Generic.WhiteSpace.IncrementDecrementSpacing.SpaceAfterDecrement"/> 55*e3cafdc2SMichael Große <exclude name="Generic.WhiteSpace.IncrementDecrementSpacing.SpaceAfterIncrement"/> 56*e3cafdc2SMichael Große 57*e3cafdc2SMichael Große <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis"/> 58*e3cafdc2SMichael Große <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword"/> 59*e3cafdc2SMichael Große <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace"/> 60*e3cafdc2SMichael Große <exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace"/> 61*e3cafdc2SMichael Große <exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.NoSpaceBeforeArrow"/> 62*e3cafdc2SMichael Große <exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.NoSpaceAfterArrow"/> 63*e3cafdc2SMichael Große <exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.SpacingBeforeAs"/> 64*e3cafdc2SMichael Große <exclude name="Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterSecond"/> 65*e3cafdc2SMichael Große <exclude name="Squiz.ControlStructures.ForLoopDeclaration.NoSpaceAfterSecond"/> 66*e3cafdc2SMichael Große <exclude name="Squiz.ControlStructures.ForLoopDeclaration.NoSpaceAfterFirst"/> 67*e3cafdc2SMichael Große <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.NoSpaceBeforeArg"/> 68*e3cafdc2SMichael Große <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceAfterEquals"/> 69*e3cafdc2SMichael Große <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterReference"/> 70*e3cafdc2SMichael Große <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose"/> 71*e3cafdc2SMichael Große <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceBeforeEquals"/> 72*e3cafdc2SMichael Große <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/> 73*e3cafdc2SMichael Große <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.NewlineBeforeOpenBrace"/> 74*e3cafdc2SMichael Große <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.CloseBracketLine"/> 75*e3cafdc2SMichael Große <exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen"/> 76*e3cafdc2SMichael Große <exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/> 77*e3cafdc2SMichael Große <exclude name="Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore"/> 78*e3cafdc2SMichael Große <exclude name="Squiz.WhiteSpace.ScopeClosingBrace.Indent"/> 79*e3cafdc2SMichael Große <exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine"/> 80*e3cafdc2SMichael Große 81*e3cafdc2SMichael Große <exclude name="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody"/> 82*e3cafdc2SMichael Große <exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine"/> 83*e3cafdc2SMichael Große <exclude name="PSR2.Classes.PropertyDeclaration.StaticBeforeVisibility"/> 84*e3cafdc2SMichael Große <exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/> 85*e3cafdc2SMichael Große <exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpaceBeforeCloseBrace"/> 86*e3cafdc2SMichael Große <exclude name="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed"/> 87*e3cafdc2SMichael Große <exclude name="PSR2.ControlStructures.SwitchDeclaration.BreakIndent"/> 88*e3cafdc2SMichael Große <exclude name="PSR2.ControlStructures.SwitchDeclaration.BreakNotNewLine"/> 89*e3cafdc2SMichael Große <exclude name="PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE"/> 90*e3cafdc2SMichael Große <exclude name="PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonDEFAULT"/> 91*e3cafdc2SMichael Große <exclude name="PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonCASE"/> 92*e3cafdc2SMichael Große <exclude name="PSR2.Files.EndFileNewline.TooMany"/> 93*e3cafdc2SMichael Große <exclude name="PSR2.Files.EndFileNewline.NoneFound"/> 94*e3cafdc2SMichael Große <exclude name="PSR2.Methods.FunctionCallSignature.Indent"/> 95*e3cafdc2SMichael Große <exclude name="PSR2.Methods.FunctionCallSignature.EmptyLine"/> 96*e3cafdc2SMichael Große <exclude name="PSR2.Methods.FunctionCallSignature.ContentAfterOpenBracket"/> 97*e3cafdc2SMichael Große <exclude name="PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket"/> 98*e3cafdc2SMichael Große <exclude name="PSR2.Methods.FunctionCallSignature.CloseBracketLine"/> 99*e3cafdc2SMichael Große <exclude name="PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket"/> 100*e3cafdc2SMichael Große <exclude name="PSR2.Methods.FunctionCallSignature.SpaceAfterOpenBracket"/> 101*e3cafdc2SMichael Große <exclude name="PSR2.Methods.FunctionCallSignature.MultipleArguments"/> 102*e3cafdc2SMichael Große <exclude name="PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose"/> 103*e3cafdc2SMichael Große <exclude name="PSR2.Methods.MethodDeclaration.StaticBeforeVisibility"/> 104*e3cafdc2SMichael Große <exclude name="PSR2.Namespaces.NamespaceDeclaration.BlankLineAfter"/> 105*e3cafdc2SMichael 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> 14927f63a23SAndreas Gohr <exclude-pattern>*/inc/fulltext.php</exclude-pattern> 15027f63a23SAndreas Gohr <exclude-pattern>*/inc/Mailer.class.php</exclude-pattern> 1511a953a5bSAndreas Gohr <exclude-pattern>*/doku.php</exclude-pattern> 1521a953a5bSAndreas Gohr <exclude-pattern>*/install.php</exclude-pattern> 1530da4ba1bSAndreas Gohr <exclude-pattern>*/inc/utf8.php</exclude-pattern> 1541a953a5bSAndreas Gohr <exclude-pattern>*/feed.php</exclude-pattern> 155f4251554SAndreas Gohr <exclude-pattern>*/inc/load.php</exclude-pattern> 1562b2d0ba9SAndreas Gohr <exclude-pattern>*/bin/*.php</exclude-pattern> 157b78f68bcSAndreas Gohr <exclude-pattern>*/lib/exe/*.php</exclude-pattern> 1582b2d0ba9SAndreas Gohr </rule> 1592b2d0ba9SAndreas Gohr 160994e9d4eSAndreas Gohr</ruleset> 161