Build/Config/phpcs.xml
2022-10-08 21:34:58 +02:00

225 lines
10 KiB
XML
Executable File

<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="default">
<description></description>
<exclude-pattern>*.css</exclude-pattern>
<exclude-pattern>*.csv.php</exclude-pattern>
<exclude-pattern>*.pdf.php</exclude-pattern>
<exclude-pattern>*.tpl.php</exclude-pattern>
<exclude-pattern>*.xls.php</exclude-pattern>
<exclude-pattern>*/Build/*</exclude-pattern>
<exclude-pattern>*/Cache/*</exclude-pattern>
<exclude-pattern>*/Demo/*</exclude-pattern>
<exclude-pattern>*/Docs/*</exclude-pattern>
<exclude-pattern>*/Documentation/*</exclude-pattern>
<exclude-pattern>*/Hooks/*</exclude-pattern>
<exclude-pattern>*/Modules/Media/Files/*</exclude-pattern>
<exclude-pattern>*/Admin/Install/Application/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/Resources/*</exclude-pattern>
<exclude-pattern>*/Libraries/*</exclude-pattern>
<exclude-pattern>*/Web/*</exclude-pattern>
<exclude-pattern>*/omsSetup/*</exclude-pattern>
<exclude-pattern>*/demoSetup/*</exclude-pattern>
<exclude-pattern>*/Routes/*</exclude-pattern>
<exclude-pattern>*/Tools/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/OAuth2/*</exclude-pattern><!-- @todo: temporarily disabled-->
<exclude-pattern>*/Mail/*</exclude-pattern><!-- @todo: temporarily disabled-->
<exclude-pattern>*Hooks.php</exclude-pattern>
<exclude-pattern>*Markdown.js</exclude-pattern>
<exclude-pattern>*Markdown.php</exclude-pattern>
<exclude-pattern>*ObjLoader.js</exclude-pattern>
<exclude-pattern>*Routes.php</exclude-pattern>
<exclude-pattern>*SearchCommands.php</exclude-pattern>
<exclude-pattern>*Sha1.js</exclude-pattern>
<exclude-pattern>*Sha1b.js</exclude-pattern>
<exclude-pattern>[abcdef0-9]{32}/*</exclude-pattern>
<arg value="q"/>
<arg name="colors"/>
<arg name="tab-width" value="4"/>
<!-- <rule ref="Generic.Classes.DuplicateClassName"/> @todo: disabled until bug is fixed. currently namespace is ignored which creates a lot of false positives e.g. Installer, Updater, Controller, etc. -->
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall">
<exclude-pattern>*Sort.php</exclude-pattern>
<exclude-pattern>*Gamma.php</exclude-pattern>
</rule>
<rule ref="Generic.CodeAnalysis.JumbledIncrementer">
<exclude-pattern>*Sort.php</exclude-pattern>
</rule>
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
<rule ref="Generic.Commenting.Todo">
<severity>0</severity>
</rule>
<rule ref="Generic.Commenting.Fixme">
<severity>3</severity>
</rule>
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Generic.PHP.DisallowAlternativePHPTags"/>
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
<rule ref="Generic.PHP.DiscourageGoto"/>
<!--<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array" value="delete=>unset,print=>echo,create_function=>null" />
</properties>
</rule>-->
<rule ref="Generic.Files.ByteOrderMark"/>
<!--<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="180"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
<exclude-pattern>*Mapper.php</exclude-pattern>
<exclude-pattern>*TDistribution.php</exclude-pattern>
<exclude-pattern>*ChiSquaredDistribution.php</exclude-pattern>
</rule>-->
<rule ref="Generic.Files.OneTraitPerFile"/>
<rule ref="Generic.Files.OneInterfacePerFile"/>
<rule ref="Generic.Files.OneClassPerFile"/>
<rule ref="Generic.Files.OneObjectStructurePerFile"/>
<rule ref="Generic.Files.LineEndings">
<properties>
<property name="eolChar" value="\n"/>
</properties>
</rule>
<rule ref="Generic.Debug.ESLint"/>
<rule ref="Generic.Debug.CSSLint"/>
<rule ref="Generic.Formatting.DisallowMultipleStatements">
<exclude-pattern>*/tests/*</exclude-pattern><!-- inline function definition -->
</rule>
<rule ref="Generic.Formatting.MultipleStatementAlignment">
<exclude-pattern>*oLib.js</exclude-pattern><!-- I don't know why it doesn't understand this -->
<exclude-pattern>*StringUtils.js</exclude-pattern><!-- I don't know why it doesn't understand this -->
</rule>
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<rule ref="Generic.Functions.CallTimePassByReference"/>
<!--<rule ref="Generic.Metrics.CyclomaticComplexity">
<properties>
<property name="complexity" value="15"/>
<property name="absoluteComplexity" value="25"/>
</properties>
<exclude-pattern>*Measurement.php</exclude-pattern>
</rule> -->
<rule ref="Generic.Metrics.NestingLevel">
<properties>
<property name="nestingLevel" value="5"/>
<property name="absoluteNestingLevel" value="11"/>
</properties>
<exclude-pattern>*EigenvalueDecomposition.php</exclude-pattern><!-- Algorithm uses deep nesting -->
<exclude-pattern>*phpOMS/Message/Http/HttpRequest.php</exclude-pattern><!-- Multipart uses deep nesting -->
<exclude-pattern>*Router.php</exclude-pattern><!-- WebRouter uses deep nesting -->
<exclude-pattern>*Mail.php</exclude-pattern><!-- Mail uses deep nesting -->
<exclude-pattern>*Exchange/Interfaces*</exclude-pattern><!-- Exchange interfaces can be deeply nested -->
</rule>
<rule ref="Generic.PHP.RequireStrictTypes"/>
<rule ref="Generic.NamingConventions.ConstructorName"/>
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<rule ref="Generic.PHP.LowerCaseConstant"/>
<rule ref="Generic.PHP.NoSilencedErrors">
<exclude-pattern>*Server.php</exclude-pattern><!-- Socket shouldn't output errors -->
<exclude-pattern>*Ftp/File.php</exclude-pattern><!-- Socket shouldn't output errors -->
<exclude-pattern>*Ftp/Directory.php</exclude-pattern><!-- Socket shouldn't output errors -->
</rule>
<rule ref="Generic.Strings.UnnecessaryStringConcat">
<properties>
<property name="allowMultiline" value="true" />
</properties>
</rule>
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass">
<severity>3</severity>
</rule>
<rule ref="PEAR.Classes.ClassDeclaration"/>
<rule ref="PEAR.Commenting.FileComment">
<exclude name="PEAR.Commenting.FileComment.InvalidPackage"/>
<exclude name="PEAR.Commenting.FileComment.IncompleteCopyright"/>
<exclude name="PEAR.Commenting.FileComment.InvalidVersion"/>
<exclude name="PEAR.Commenting.FileComment.MissingAuthorTag"/>
<exclude name="PEAR.Commenting.FileComment.MissingCategoryTag"/>
</rule>
<rule ref="PEAR.Commenting.ClassComment">
<exclude name="PEAR.Commenting.ClassComment.InvalidPackage"/>
<exclude name="PEAR.Commenting.ClassComment.IncompleteCopyright"/>
<exclude name="PEAR.Commenting.ClassComment.MissingAuthorTag"/>
<exclude name="PEAR.Commenting.ClassComment.MissingCategoryTag"/>
<exclude name="PEAR.Commenting.ClassComment.InvalidVersion"/>
</rule>
<rule ref="PEAR.Commenting.FunctionComment">
<severity>7</severity>
<exclude name="PEAR.Commenting.FunctionComment.MissingParamTag"/><!-- Important for @inheritdoc -->
<exclude name="PEAR.Commenting.FunctionComment.MissingReturn"/><!-- Important for @inheritdoc -->
<exclude-pattern>*/tests/*</exclude-pattern><!-- Tests don't need comments -->
</rule>
<rule ref="PEAR.Commenting.InlineComment"/>
<rule ref="PEAR.ControlStructures.ControlSignature"/>
<rule ref="PEAR.Functions.ValidDefaultValue"/>
<rule ref="PSR1.Files.SideEffects">
<exclude-pattern>*Autoloader.php</exclude-pattern><!-- Just a wrapper -->
</rule>
<rule ref="PSR1.Classes.ClassDeclaration">
<severity>3</severity>
<exclude-pattern>*Pdf.php</exclude-pattern><!-- Just a wrapper -->
<exclude-pattern>*Excel.php</exclude-pattern><!-- Just a wrapper -->
<exclude-pattern>*/tests/*</exclude-pattern><!-- Tests don't always have side effects -->
</rule>
<rule ref="PSR2.Classes.ClassDeclaration"/>
<rule ref="PSR2.Classes.PropertyDeclaration"/>
<rule ref="PSR2.ControlStructures.ControlStructureSpacing"/>
<rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
<rule ref="PSR2.ControlStructures.SwitchDeclaration"/>
<rule ref="PSR2.Files.EndFileNewline"/>
<rule ref="PSR2.Methods.MethodDeclaration"/>
<rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
<rule ref="PSR2.Namespaces.UseDeclaration"/>
<rule ref="PSR12.Files.OpenTag"/>
<rule ref="PSR12.Properties.ConstantVisibility"/>
<!--<rule ref="PSR12.Functions.ReturnTypeDeclaration"/>-->
<rule ref="MySource.Objects.AssignThis">
<exclude-pattern>*DragNDrop.js</exclude-pattern>
</rule>
<rule ref="MySource.PHP.EvalObjectFactory"/>
<rule ref="MySource.PHP.GetRequestData">
<exclude-pattern>*Request.php</exclude-pattern>
</rule>
<rule ref="Squiz.Classes.DuplicateProperty"/>
<rule ref="Squiz.CSS.DuplicateStyleDefinition"/>
<rule ref="Squiz.CSS.EmptyClassDefinition"/>
<rule ref="Squiz.CSS.EmptyStyleDefinition"/>
<rule ref="Squiz.CSS.Indentation"/>
<rule ref="Squiz.CSS.LowercaseStyleDefinition"/>
<rule ref="Squiz.CSS.MissingColon"/>
<rule ref="Squiz.CSS.ShorthandSize"/>
<rule ref="Squiz.Functions.GlobalFunction">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="Squiz.PHP.GlobalKeyword"/>
<rule ref="Squiz.PHP.NonExecutableCode"/>
<rule ref="Squiz.Scope.StaticThisUsage"/>
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<!--<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
<exclude-pattern>*HttpUri.js</exclude-pattern>--><!-- Regex false positive -->
<!--</rule>-->
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing">
</rule>
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
<rule ref="Zend.Files.ClosingTag"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="tabIndent" value="true"/>
</properties>
<exclude-pattern>*ResponseType.js</exclude-pattern>
<exclude-pattern>*HttpUri.js</exclude-pattern>
</rule>
</ruleset>