MD_QA/rules/md_phpcs_rules_basic.xml

224 lines
7.4 KiB
XML

<?xml version="1.0"?>
<ruleset name="museumdigital">
<description>Coding standard for museum-digital.
Based on Zend with some additions.</description>
<!-- Include most of PEAR standard -->
<rule ref='Generic.Commenting'/>
<rule ref='PEAR.Commenting.FunctionComment'/>
<rule ref='Squiz.Commenting.DocCommentAlignment'/>
<rule ref='Squiz.Commenting.FunctionComment'/>
<!-- <rule ref='Squiz.Commenting.ClassComment'/>-->
<!--
-->
<!--
<rule ref='PEAR.ControlStructures.ControlSignature'>
<properties>
<property name="spacing" value="5" />
</properties>
</rule>
-->
<rule ref='PEAR.ControlStructures.MultiLineCondition'/>
<rule ref='Squiz.ControlStructures.ElseIfDeclaration'/>
<rule ref='Squiz.ControlStructures.ForEachLoopDeclaration'/>
<rule ref='Squiz.ControlStructures.ForLoopDeclaration'/>
<!--
Warns if there are inline control structures. E.g. if (true == false) echo "HI";
<rule ref="Generic.ControlStructures.InlineControlStructure">
<properties>
<property name="error" value="true" />
</properties>
</rule>
-->
<!--
Warn about lines longer than 100 chars,
and error for lines longer than 135 chars.
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="130" />
<property name="absoluteLineLimit" value="140" />
</properties>
</rule>
-->
<!-- Don't check function braces, but check closure braces. -->
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie">
<properties>
<property name="checkFunctions" value="false" />
<property name="checkClosures" value="true" />
</properties>
</rule>
<rule ref="Generic.Debug.ClosureLinter">
<properties>
<property name="errorCodes" type="array" value="0210"/>
<property name="ignoreCodes" type="array" value="0001,0110,0240"/>
</properties>
</rule>
<rule ref='Generic.CodeAnalysis.UnconditionalIfStatement'/>
<rule ref='Generic.CodeAnalysis.UnusedFunctionParameter'/>
<rule ref='PEAR.Files'/>
<rule ref='PEAR.Formatting'/>
<rule ref='Generic.Functions.OpeningFunctionBraceKernighanRitchie'/>
<rule ref='Generic.Functions.FunctionCallArgumentSpacing'/>
<!--
<rule ref='PEAR.Functions.FunctionCallSignature'/>
<rule ref='PEAR.Functions.FunctionDeclaration'/>
-->
<rule ref='Squiz.Functions.FunctionDeclaration'/>
<rule ref='PEAR.Functions.ValidDefaultValue'/>
<rule ref='PEAR.NamingConventions.ValidClassName'/>
<!-- Have code block comments look like // end foreach() etc.
<rule ref="Squiz.Commenting.LongConditionClosingComment">
<properties>
<property name="lineLimit" value="40" />
<property name="commentFormat" value="// end" />
</properties>
</rule> -->
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1" />
</properties>
</rule>
<rule ref='Zend.Files.ClosingTag'/>
<!--
<rule ref='Zend.NamingConventions.ValidVariableName' />
<rule ref='PEAR.NamingConventions.ValidFunctionName'/>
We may enforce these at some point in time. We don't atm.
<rule ref="Generic.Metrics.CyclomaticComplexity">
<properties>
<property name="complexity" value="24" />
<property name="absoluteComplexity" value="36" />
</properties>
</rule>
<rule ref="Generic.Metrics.NestingLevel">
<properties>
<property name="nestingLevel" value="24" />
<property name="absoluteNestingLevel" value="30" />
</properties>
</rule>
-->
<rule ref='PEAR.NamingConventions.ValidVariableName'/>
<rule ref='Generic.PHP.DeprecatedFunctions'/>
<rule ref='Generic.PHP.CharacterBeforePHPOpeningTag'/>
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<!-- Starting phpcs 3.3 we should use this
<property name="forbiddenFunctions" type="array">
<element key="delete" value="unset"/>
<element key="print" value="echo"/>
<element key="create_function" value="null"/>
<element key="system" value="null"/>
<element key="sizeof" value="count"/>
</property>
-->
<property name="forbiddenFunctions" type="array" value="delete=>unset,print=>echo,create_function=>null,system=>null,sizeof=>count,escapeshellcmd=>escapeshellarg" />
</properties>
</rule>
<rule ref="Internal.NoCodeFound">
</rule>
<rule ref="Squiz.PHP.DiscouragedFunctions">
<properties>
<property name="error" value="true" />
</properties>
</rule>
<!--
Should be introduced later:
<rule ref='Generic.PHP.NoSilencedErrorsSniff'/>
<rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
<type>warning</type>
</rule>
-->
<rule ref='Squiz.PHP.DisallowSizeFunctionsInLoops'/>
<rule ref='Squiz.Strings.EchoedStrings'/>
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="spacing" value="1" />
</properties>
</rule>
<rule ref='PEAR.WhiteSpace'/>
<rule ref='Generic.WhiteSpace.DisallowTabIndent'/>
<rule ref="Generic.Strings.UnnecessaryStringConcat">
<properties>
<property name="allowMultiline" value="true" />
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true" />
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<!-- <property name="ignoreBlankLines" value="true" /> -->
</properties>
</rule>
<!-- Ensure 1 blank line before and after functions, except at the top and bottom. -->
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
<properties>
<property name="spacing" value="1" />
<property name="spacingBeforeFirst" value="0" />
<property name="spacingAfterLast" value="0" />
</properties>
</rule>
<rule ref='Squiz.WhiteSpace.SemicolonSpacing'/>
<rule ref='Squiz.WhiteSpace.ScopeKeywordSpacing'/>
<rule ref='Squiz.WhiteSpace.ScopeClosingBrace'/>
<rule ref='Squiz.WhiteSpace.CastSpacing'/>
<rule ref='Squiz.WhiteSpace.FunctionClosingBraceSpace'/>
<rule ref='Squiz.PHP.Eval'/>
<rule ref='Squiz.PHP.DisallowBooleanStatement'/>
<rule ref='Squiz.Arrays.ArrayBracketSpacing'/>
<!--
<rule ref='Squiz.WhiteSpace.MemberVarSpacing'/>
<rule ref='Squiz.Operators.ComparisonOperatorUsage'/>
CSS
-->
<!-- Include some CSS rules I want to enforce
<rule ref='Squiz.CSS.ClassDefinitionOpeningBraceSpace'/>
<rule ref='Squiz.CSS.ClassDefinitionClosingBraceSpace'/>
<rule ref='Squiz.CSS.Indentation'/>
-->
<rule ref='Squiz.CSS.DuplicateStyleDefinition'/>
<rule ref='Squiz.CSS.ClassDefinitionNameSpacing'/>
<rule ref='Squiz.CSS.ColonSpacing'/>
<rule ref='Squiz.CSS.EmptyClassDefinition'/>
<rule ref='Squiz.CSS.ColourDefinition'/>
<rule ref='Squiz.CSS.SemicolonSpacing'/>
<!-- <rule ref='MySource.CSS.BrowserSpecificStyles'/> -->
<!--
Javascript
-->
<rule ref='Squiz.Debug.JSLint'/>
</ruleset>