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 --> 38*903d43feSMichael Große <rule ref="PSR12"> 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"/> 106*903d43feSMichael Große 107*903d43feSMichael Große <exclude name="PSR12.Classes.ClassInstantiation.MissingParentheses"/> 108*903d43feSMichael Große <exclude name="PSR12.ControlStructures.BooleanOperatorPlacement.FoundMixed"/> 109*903d43feSMichael Große <exclude name="PSR12.ControlStructures.ControlStructureSpacing.FirstExpressionLine"/> 110*903d43feSMichael Große <exclude name="PSR12.ControlStructures.ControlStructureSpacing.CloseParenthesisLine"/> 111*903d43feSMichael Große <exclude name="PSR12.ControlStructures.ControlStructureSpacing.LineIndent"/> 112*903d43feSMichael Große <exclude name="PSR12.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/> 113*903d43feSMichael Große <exclude name="PSR12.ControlStructures.ControlStructureSpacing.SpaceBeforeCloseBrace"/> 114*903d43feSMichael Große <exclude name="PSR12.Files.FileHeader.SpacingAfterBlock"/> 115*903d43feSMichael Große <exclude name="PSR12.Operators.OperatorSpacing.NoSpaceBefore"/> 116*903d43feSMichael Große <exclude name="PSR12.Operators.OperatorSpacing.NoSpaceAfter"/> 117*903d43feSMichael Große 118*903d43feSMichael Große <exclude name="PSR12.Properties.ConstantVisibility.NotFound"/> 119994e9d4eSAndreas Gohr </rule> 12099c1e5dfSAndreas Gohr 12199c1e5dfSAndreas Gohr <!-- disable some rules for certain paths, for legacy support --> 12299c1e5dfSAndreas Gohr <rule ref="Squiz.Classes.ValidClassName.NotCamelCaps"> 12399c1e5dfSAndreas Gohr <exclude-pattern>*/inc/Plugin.php</exclude-pattern> 12499c1e5dfSAndreas Gohr <exclude-pattern>*/inc/PluginInterface.php</exclude-pattern> 125dd8af038SAndreas Gohr <exclude-pattern>*/inc/PluginTrait.php</exclude-pattern> 126e79ce394SAndreas Gohr 12782f7cb05SAndreas Gohr <exclude-pattern>*/lib/plugins/*.php</exclude-pattern> 12899c1e5dfSAndreas Gohr <exclude-pattern>*/lib/plugins/*/action.php</exclude-pattern> 129e79ce394SAndreas Gohr <exclude-pattern>*/lib/plugins/*/action/*.php</exclude-pattern> 13099c1e5dfSAndreas Gohr <exclude-pattern>*/lib/plugins/*/admin.php</exclude-pattern> 131e79ce394SAndreas Gohr <exclude-pattern>*/lib/plugins/*/admin/*.php</exclude-pattern> 13299c1e5dfSAndreas Gohr <exclude-pattern>*/lib/plugins/*/auth.php</exclude-pattern> 133e79ce394SAndreas Gohr <exclude-pattern>*/lib/plugins/*/auth/*.php</exclude-pattern> 13499c1e5dfSAndreas Gohr <exclude-pattern>*/lib/plugins/*/cli.php</exclude-pattern> 135e79ce394SAndreas Gohr <exclude-pattern>*/lib/plugins/*/cli/*.php</exclude-pattern> 136e79ce394SAndreas Gohr <exclude-pattern>*/lib/plugins/*/helper.php</exclude-pattern> 137e79ce394SAndreas Gohr <exclude-pattern>*/lib/plugins/*/helper/*.php</exclude-pattern> 13899c1e5dfSAndreas Gohr <exclude-pattern>*/lib/plugins/*/remote.php</exclude-pattern> 139e79ce394SAndreas Gohr <exclude-pattern>*/lib/plugins/*/remote/*.php</exclude-pattern> 14099c1e5dfSAndreas Gohr <exclude-pattern>*/lib/plugins/*/syntax.php</exclude-pattern> 141e79ce394SAndreas Gohr <exclude-pattern>*/lib/plugins/*/syntax/*.php</exclude-pattern> 14299c1e5dfSAndreas Gohr </rule> 14382f7cb05SAndreas Gohr 14482f7cb05SAndreas Gohr <!-- underscore skips exposing public methods to remote api --> 14582f7cb05SAndreas Gohr <rule ref="PSR2.Methods.MethodDeclaration.Underscore"> 1461dce0478SAndreas Gohr <exclude-pattern>*/inc/Extension/RemotePlugin.php</exclude-pattern> 14782f7cb05SAndreas Gohr <exclude-pattern>*/lib/plugins/*/remote.php</exclude-pattern> 14882f7cb05SAndreas Gohr <exclude-pattern>*/lib/plugins/*/remote/*.php</exclude-pattern> 14982f7cb05SAndreas Gohr </rule> 15082f7cb05SAndreas Gohr 15199c1e5dfSAndreas Gohr <rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"> 1521dce0478SAndreas Gohr <exclude-pattern>*/inc/Extension/PluginInterface.php</exclude-pattern> 1531dce0478SAndreas Gohr <exclude-pattern>*/inc/Extension/PluginTrait.php</exclude-pattern> 15499c1e5dfSAndreas Gohr </rule> 15599c1e5dfSAndreas Gohr 15627f63a23SAndreas Gohr <!-- for now we mix declarations and execution here (mostly for defines) --> 1572b2d0ba9SAndreas Gohr <rule ref="PSR1.Files.SideEffects"> 15827f63a23SAndreas Gohr <exclude-pattern>*/index.php</exclude-pattern> 15927f63a23SAndreas Gohr <exclude-pattern>*/inc/parserutils.php</exclude-pattern> 16027f63a23SAndreas Gohr <exclude-pattern>*/inc/mail.php</exclude-pattern> 16127f63a23SAndreas Gohr <exclude-pattern>*/inc/init.php</exclude-pattern> 162cc8fc761SMichael Große <exclude-pattern>*/inc/farm.php</exclude-pattern> 16327f63a23SAndreas Gohr <exclude-pattern>*/inc/fulltext.php</exclude-pattern> 164cc8fc761SMichael Große <exclude-pattern>*/inc/pluginutils.php</exclude-pattern> 1656225b270SMichael Große <exclude-pattern>*/inc/indexer.php</exclude-pattern> 16627f63a23SAndreas Gohr <exclude-pattern>*/inc/Mailer.class.php</exclude-pattern> 1671a953a5bSAndreas Gohr <exclude-pattern>*/doku.php</exclude-pattern> 1681a953a5bSAndreas Gohr <exclude-pattern>*/install.php</exclude-pattern> 1690da4ba1bSAndreas Gohr <exclude-pattern>*/inc/utf8.php</exclude-pattern> 1701a953a5bSAndreas Gohr <exclude-pattern>*/feed.php</exclude-pattern> 171f4251554SAndreas Gohr <exclude-pattern>*/inc/load.php</exclude-pattern> 1722b2d0ba9SAndreas Gohr <exclude-pattern>*/bin/*.php</exclude-pattern> 173b78f68bcSAndreas Gohr <exclude-pattern>*/lib/exe/*.php</exclude-pattern> 1742b2d0ba9SAndreas Gohr </rule> 1752b2d0ba9SAndreas Gohr 176994e9d4eSAndreas Gohr</ruleset> 177