|
| 1 | +<?xml version="1.0"?> |
| 2 | +<ruleset name="Consistence"> |
| 3 | + |
| 4 | + <!-- copy of https://github.com/consistence/coding-standard/blob/master/Consistence/ruleset.xml for local checking usage --> |
| 5 | + |
| 6 | + <rule ref="Generic.Arrays.DisallowLongArraySyntax"/> |
| 7 | + <rule ref="Generic.Classes.DuplicateClassName"/> |
| 8 | + <rule ref="Generic.CodeAnalysis.EmptyStatement"> |
| 9 | + <exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCATCH"/><!-- empty catch statements are allowed --> |
| 10 | + </rule> |
| 11 | + <rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/> |
| 12 | + <rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/> |
| 13 | + <rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/> |
| 14 | + <rule ref="Generic.Files.InlineHTML"/> |
| 15 | + <rule ref="Generic.Formatting.SpaceAfterCast"/> |
| 16 | + <rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman"/> |
| 17 | + <rule ref="Generic.NamingConventions.ConstructorName"/> |
| 18 | + <rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/> |
| 19 | + <rule ref="Generic.PHP.DeprecatedFunctions"/> |
| 20 | + <rule ref="Generic.PHP.DisallowAlternativePHPTags"/> |
| 21 | + <rule ref="Generic.PHP.ForbiddenFunctions"/> |
| 22 | + <rule ref="Generic.Strings.UnnecessaryStringConcat"> |
| 23 | + <properties> |
| 24 | + <property name="allowMultiline" value="true"/> |
| 25 | + </properties> |
| 26 | + </rule> |
| 27 | + <rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/> |
| 28 | + <rule ref="Generic.WhiteSpace.ScopeIndent"> |
| 29 | + <properties> |
| 30 | + <property name="tabIndent" value="true"/> |
| 31 | + </properties> |
| 32 | + </rule> |
| 33 | + <rule ref="PEAR.Classes.ClassDeclaration"/> |
| 34 | + <rule ref="PEAR.Commenting.InlineComment"/> |
| 35 | + <rule ref="PEAR.Formatting.MultiLineAssignment"/> |
| 36 | + <rule ref="PEAR.WhiteSpace.ObjectOperatorIndent"/> |
| 37 | + <rule ref="PSR2"> |
| 38 | + <exclude name="Generic.Files.LineLength"/><!-- can not be suppressed --> |
| 39 | + <exclude name="Generic.WhiteSpace.DisallowTabIndent"/><!-- don't check indentation with spaces --> |
| 40 | + <exclude name="PEAR.Functions.ValidDefaultValue"/><!-- we want to allow null as "default" value --> |
| 41 | + <exclude name="PSR2.Classes.ClassDeclaration"/><!-- we want whitespace around class body and rules for extends and implements, using PEAR instead --> |
| 42 | + <exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/><!-- we want to put first expression of multiline condition on next line --> |
| 43 | + <exclude name="PSR2.ControlStructures.SwitchDeclaration.caseIndent"/><!-- checked by more generic Generic.WhiteSpace.ScopeIndent.Incorrect --> |
| 44 | + <exclude name="PSR2.ControlStructures.SwitchDeclaration.defaultIndent"/><!-- checked by more generic Generic.WhiteSpace.ScopeIndent.Incorrect --> |
| 45 | + <exclude name="Squiz.Functions.LowercaseFunctionKeywords"/><!-- checked by more generic Generic.PHP.LowerCaseKeyword --> |
| 46 | + <exclude name="Squiz.ControlStructures.LowercaseDeclaration"/><!-- checked by more generic Generic.PHP.LowerCaseKeyword --> |
| 47 | + <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.NewlineBeforeOpenBrace"/><!-- clashes with OpeningFunctionBraceBsdAllman --> |
| 48 | + <exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen"/><!-- we want to allow empty line in control structure e.g. in catch blocks, where it can improve readability --> |
| 49 | + <exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace"/><!-- we want to put first expression of multiline condition on next line --> |
| 50 | + <exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/><!-- we want to allow empty line in control structure e.g. in try blocks, where it can improve readability --> |
| 51 | + </rule> |
| 52 | + <rule ref="Squiz.Arrays.ArrayBracketSpacing"/> |
| 53 | + <rule ref="Squiz.Arrays.ArrayDeclaration"> |
| 54 | + <exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNewLine"/><!-- does not handle wrapped content --> |
| 55 | + <exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned"/><!-- expects closing brace at the same level as opening brace --> |
| 56 | + <exclude name="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned"/><!-- we don't want spacing with alignment --> |
| 57 | + <exclude name="Squiz.Arrays.ArrayDeclaration.FirstIndexNoNewline"/><!-- expects multi-value array always written on multiple lines --> |
| 58 | + <exclude name="Squiz.Arrays.ArrayDeclaration.FirstValueNoNewline"/><!-- expects multi-value array always written on multiple lines --> |
| 59 | + <exclude name="Squiz.Arrays.ArrayDeclaration.KeyNotAligned"/><!-- uses indentation of only single space --> |
| 60 | + <exclude name="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed"/><!-- even a single-value array can be written on multiple lines --> |
| 61 | + <exclude name="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast"/><!-- expects multi-value array always written on multiple lines --> |
| 62 | + <exclude name="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed"/><!-- multiple values can be written on a single line --> |
| 63 | + <exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned"/><!-- we don't want spacing with alignment --> |
| 64 | + </rule> |
| 65 | + <rule ref="Squiz.Classes.ClassFileName"/> |
| 66 | + <rule ref="Squiz.Classes.SelfMemberReference"/> |
| 67 | + <rule ref="Squiz.Commenting.DocCommentAlignment"> |
| 68 | + <exclude name="Squiz.Commenting.DocCommentAlignment.SpaceAfterStar"/><!-- space needed for indented annotations --> |
| 69 | + </rule> |
| 70 | + <rule ref="Squiz.Commenting.EmptyCatchComment"/> |
| 71 | + <rule ref="Squiz.Commenting.FunctionComment"> |
| 72 | + <exclude name="Squiz.Commenting.FunctionComment.EmptyThrows"/><!-- @throws are forbidden --> |
| 73 | + <exclude name="Squiz.Commenting.FunctionComment.IncorrectTypeHint"/><!-- collection syntax such as string[] is not supported --> |
| 74 | + <exclude name="Squiz.Commenting.FunctionComment.InvalidReturn"/><!-- enforces incorrect types --> |
| 75 | + <exclude name="Squiz.Commenting.FunctionComment.InvalidReturnNotVoid"/><!-- is not able to detect return types such as string|null as correct --> |
| 76 | + <exclude name="Squiz.Commenting.FunctionComment.InvalidThrows"/><!-- @throws are forbidden --> |
| 77 | + <exclude name="Squiz.Commenting.FunctionComment.Missing"/><!-- PHPDoc is not required on all methods --> |
| 78 | + <exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/><!-- comments are not required for @param --> |
| 79 | + <exclude name="Squiz.Commenting.FunctionComment.MissingReturn"/><!-- void type is not used --> |
| 80 | + <exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"/><!-- comments don't have to be sentences --> |
| 81 | + <exclude name="Squiz.Commenting.FunctionComment.ParamCommentNotCapital"/><!-- comments don't have to be sentences --> |
| 82 | + <exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing"/><!-- works only for code requiring PHP 7 code or better --> |
| 83 | + <exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamName"/><!-- we don't want spacing with alignment --> |
| 84 | + <exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType"/><!-- we don't want spacing with alignment --> |
| 85 | + <exclude name="Squiz.Commenting.FunctionComment.ThrowsNoFullStop"/><!-- @throws are forbidden --> |
| 86 | + <exclude name="Squiz.Commenting.FunctionComment.ThrowsNotCapital"/><!-- @throws are forbidden --> |
| 87 | + <exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing"/><!-- doesn't work with self as typehint --> |
| 88 | + </rule> |
| 89 | + <rule ref="Squiz.Commenting.FunctionComment.DuplicateReturn"> |
| 90 | + <message>Only 1 @return annotation is allowed in a function comment</message> |
| 91 | + </rule> |
| 92 | + <rule ref="Squiz.Commenting.FunctionComment.ExtraParamComment"> |
| 93 | + <message>Extra @param annotation</message> |
| 94 | + </rule> |
| 95 | + <rule ref="Squiz.Commenting.FunctionComment.InvalidNoReturn"> |
| 96 | + <message>Function has no return statement, but annotation @return is present</message> |
| 97 | + </rule> |
| 98 | + <rule ref="Squiz.Commenting.FunctionComment.MissingParamTag"> |
| 99 | + <message>@param annotation for parameter "%s" missing</message> |
| 100 | + </rule> |
| 101 | + <rule ref="Squiz.Functions.GlobalFunction"/> |
| 102 | + <rule ref="Squiz.Operators.IncrementDecrementUsage"> |
| 103 | + <exclude name="Squiz.Operators.IncrementDecrementUsage.NoBrackets"/><!-- afaik there is no need for brackets --> |
| 104 | + </rule> |
| 105 | + <rule ref="Squiz.Operators.ValidLogicalOperators"/> |
| 106 | + <rule ref="Squiz.PHP.GlobalKeyword"/> |
| 107 | + <rule ref="Squiz.PHP.Heredoc"/> |
| 108 | + <rule ref="Squiz.PHP.InnerFunctions"/> |
| 109 | + <rule ref="Squiz.PHP.LowercasePHPFunctions"/> |
| 110 | + <rule ref="Squiz.PHP.NonExecutableCode"/> |
| 111 | + <rule ref="Squiz.Scope.StaticThisUsage"/> |
| 112 | + <rule ref="Squiz.Strings.DoubleQuoteUsage"/> |
| 113 | + <rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar"> |
| 114 | + <message>Variable "%s" not allowed in double quoted string; use sprintf() instead</message> |
| 115 | + </rule> |
| 116 | + <rule ref="Squiz.Strings.ConcatenationSpacing"> |
| 117 | + <properties> |
| 118 | + <property name="ignoreNewlines" value="true"/> |
| 119 | + <property name="spacing" value="1"/> |
| 120 | + </properties> |
| 121 | + </rule> |
| 122 | + <rule ref="Squiz.Strings.EchoedStrings"/> |
| 123 | + <rule ref="Squiz.WhiteSpace.CastSpacing"/> |
| 124 | + <rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/> |
| 125 | + <rule ref="Squiz.WhiteSpace.FunctionSpacing"> |
| 126 | + <exclude name="Squiz.WhiteSpace.FunctionSpacing.After"/><!-- does not allow PHPUnit ignore comments --> |
| 127 | + <properties> |
| 128 | + <property name="spacing" value="1"/> |
| 129 | + </properties> |
| 130 | + </rule> |
| 131 | + <rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/> |
| 132 | + <rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/> |
| 133 | + <rule ref="Squiz.WhiteSpace.MemberVarSpacing"/> |
| 134 | + <rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing"> |
| 135 | + <properties> |
| 136 | + <property name="ignoreNewlines" value="true"/> |
| 137 | + </properties> |
| 138 | + </rule> |
| 139 | + <rule ref="Squiz.WhiteSpace.OperatorSpacing"> |
| 140 | + <properties> |
| 141 | + <property name="ignoreNewlines" value="true"/> |
| 142 | + </properties> |
| 143 | + </rule> |
| 144 | + <rule ref="Squiz.WhiteSpace.SemicolonSpacing"/> |
| 145 | + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"> |
| 146 | + <properties> |
| 147 | + <property name="ignoreBlankLines" value="false"/><!-- turned on by PSR2 -> turning off to be more general --> |
| 148 | + </properties> |
| 149 | + </rule> |
| 150 | + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines"> |
| 151 | + <severity>5</severity><!-- turned off by PSR2 -> turning on with default severity --> |
| 152 | + </rule> |
| 153 | +</ruleset> |
0 commit comments