Extend PHPCS rules by slevomat sniffs

This commit is contained in:
Joshua Ramon Enslin 2021-09-15 14:42:04 +02:00
parent 4de07f689b
commit cc7990b6f8
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -2,16 +2,52 @@
<ruleset name="museumdigital"> <ruleset name="museumdigital">
<description>Coding standard for museum-digital. <description>Coding standard for museum-digital.
Based on Zend with some additions.</description> Based on Zend with some additions.</description>
<arg name="tab-width" value="4"/>
<!-- Handle commenting --> <!-- Handle commenting -->
<!-- <rule ref='Generic.Commenting'/> -->
<rule ref='PEAR.Commenting.FunctionComment'/> <rule ref='PEAR.Commenting.FunctionComment'/>
<!-- <rule ref='Generic.Commenting'/> -->
<!-- <rule ref='Generic.Commenting.DocComment' /> --> <!-- <rule ref='Generic.Commenting.DocComment' /> -->
<rule ref='Squiz.Commenting.DocCommentAlignment'/> <rule ref='Squiz.Commenting.DocCommentAlignment'/>
<rule ref='Squiz.Commenting.FunctionComment'/> <rule ref='Squiz.Commenting.FunctionComment'/>
<rule ref='Squiz.Commenting.ClassComment'/> <rule ref='Squiz.Commenting.ClassComment'/>
<rule ref='SlevomatCodingStandard.PHP.UselessParentheses'/>
<rule ref='SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking'/>
<!-- <rule ref='SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable'/> -->
<rule ref='SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable'/>
<!-- <rule ref='SlevomatCodingStandard.Variables.UnusedVariable'/> -->
<!-- <rule ref='SlevomatCodingStandard.Variables.UselessVariable'/> -->
<rule ref='SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace'/>
<rule ref='SlevomatCodingStandard.Classes.ConstantSpacing'/>
<rule ref='SlevomatCodingStandard.PHP.TypeCast'/>
<!-- <rule ref='SlevomatCodingStandard.Classes.ClassConstantVisibility'/> -->
<rule ref='SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing'/>
<rule ref='SlevomatCodingStandard.TypeHints.PropertyTypeHintSpacing'/>
<rule ref="SlevomatCodingStandard.Classes.ClassStructure">
<properties>
<property name="groups" type="array">
<element value="uses"/>
<!-- Public constants are first but you don't care about the order of protected or private constants -->
<element value="public constants"/>
<element value="constants"/>
<!-- You don't care about the order among the properties. The same can be done with "properties" shortcut -->
<element value="public static properties, protected static properties, private static properties"/>
<element value="public properties, protected properties, private properties"/>
<element value="methods"/>
<element value="magic methods"/>
<element value="constructor"/>
<element value="destructor"/>
</property>
</properties>
</rule>
<!-- <!--
<rule ref='PEAR.ControlStructures.ControlSignature'> <rule ref='PEAR.ControlStructures.ControlSignature'>
<properties> <properties>
@ -68,6 +104,7 @@
<rule ref='PEAR.Functions.ValidDefaultValue'/> <rule ref='PEAR.Functions.ValidDefaultValue'/>
<rule ref='PEAR.NamingConventions.ValidClassName'/> <rule ref='PEAR.NamingConventions.ValidClassName'/>
<!-- <rule ref="Squiz.Classes.ValidClassName"/>-->
<!-- <!--
Have code block comments look like // end foreach() etc. Have code block comments look like // end foreach() etc.
@ -89,12 +126,14 @@
<rule ref='PEAR.NamingConventions.ValidFunctionName'/> <rule ref='PEAR.NamingConventions.ValidFunctionName'/>
<rule ref='Zend.NamingConventions.ValidVariableName' /> <rule ref='Zend.NamingConventions.ValidVariableName' />
We may enforce these at some point in time. We don't at the moment. We may enforce these at some point in time. We don't at the moment.
<rule ref="Generic.Metrics.CyclomaticComplexity"> <rule ref="Generic.Metrics.CyclomaticComplexity">
<properties> <properties>
<property name="complexity" value="24" /> <property name="complexity" value="24" />
<property name="absoluteComplexity" value="36" /> <property name="absoluteComplexity" value="36" />
</properties> </properties>
</rule> </rule>
-->
<rule ref="Generic.Metrics.NestingLevel"> <rule ref="Generic.Metrics.NestingLevel">
<properties> <properties>
@ -102,21 +141,24 @@
<property name="absoluteNestingLevel" value="30" /> <property name="absoluteNestingLevel" value="30" />
</properties> </properties>
</rule> </rule>
-->
<rule ref='PEAR.NamingConventions.ValidVariableName' /> <rule ref='PEAR.NamingConventions.ValidVariableName' />
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<rule ref="Generic.Files.ByteOrderMark"/>
<rule ref='Generic.PHP.DeprecatedFunctions' /> <rule ref='Generic.PHP.DeprecatedFunctions' />
<rule ref='Generic.PHP.CharacterBeforePHPOpeningTag' /> <rule ref='Generic.PHP.CharacterBeforePHPOpeningTag' />
<rule ref="Generic.PHP.DisallowAlternativePHPTags"/>
<rule ref='Generic.PHP.DisallowShortOpenTag' /> <rule ref='Generic.PHP.DisallowShortOpenTag' />
<!-- <!--
<rule ref='Generic.Classes.OpeningBraceSameLine' />
--> -->
<rule ref='Generic.Classes.OpeningBraceSameLine' />
<rule ref='Generic.PHP.NoSilencedErrors' /> <rule ref='Generic.PHP.NoSilencedErrors' />
<rule ref='Generic.PHP.SAPIUsage' /> <rule ref='Generic.PHP.SAPIUsage' />
<rule ref='Generic.PHP.Syntax' /> <rule ref='Generic.PHP.Syntax' />
<rule ref='Generic.Arrays.DisallowLongArraySyntax' /> <rule ref='Generic.Arrays.DisallowLongArraySyntax' />
<rule ref='Generic.Files.LineEndings' /> <rule ref='Generic.Files.LineEndings' />
<!--<rule ref='Generic.Files.InlineHTML' />--> <rule ref='Generic.Files.InlineHTML' />
<rule ref='Generic.Functions.OpeningFunctionBraceKernighanRitchie' /> <rule ref='Generic.Functions.OpeningFunctionBraceKernighanRitchie' />
<!-- <!--
@ -195,8 +237,43 @@
<rule ref='Squiz.WhiteSpace.CastSpacing'/> <rule ref='Squiz.WhiteSpace.CastSpacing'/>
<rule ref='Squiz.WhiteSpace.FunctionClosingBraceSpace'/> <rule ref='Squiz.WhiteSpace.FunctionClosingBraceSpace'/>
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<!-- PHP keywords MUST be in lower case. -->
<rule ref="Generic.PHP.LowerCaseKeyword"/>
<!-- The PHP constants true, false, and null MUST be in lower case. -->
<rule ref="Generic.PHP.LowerCaseConstant"/>
<rule ref="PSR2.Classes.PropertyDeclaration.SpacingAfterType" />
<!-- 4.3 Methods -->
<!-- Visibility MUST be declared on all methods. -->
<rule ref="Squiz.Scope.MethodScope"/>
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing"/>
<rule ref="Squiz.Functions.LowercaseFunctionKeywords"/>
<!-- <rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen"/> -->
<!-- <rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/> -->
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace"/>
<!-- <rule ref="Squiz.ControlStructures.ControlSignature"/> -->
<!-- <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/> -->
<rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
<rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterOpen">
<severity>0</severity>
</rule>
<rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingBeforeClose">
| <severity>0</severity>
</rule>
<rule ref="Squiz.ControlStructures.LowercaseDeclaration"/>
<!-- <rule ref="Generic.ControlStructures.InlineControlStructure"/> -->
<rule ref='Squiz.PHP.Eval'/> <rule ref='Squiz.PHP.Eval'/>
<rule ref='Squiz.PHP.DisallowBooleanStatement'/> <rule ref='Squiz.PHP.DisallowBooleanStatement'/>
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
<rule ref='Squiz.Arrays.ArrayBracketSpacing'/> <rule ref='Squiz.Arrays.ArrayBracketSpacing'/>
<!-- <!--
<rule ref='Squiz.Operators.ComparisonOperatorUsage'/> <rule ref='Squiz.Operators.ComparisonOperatorUsage'/>