MISP/phpcs.xml

99 lines
3.7 KiB
XML

<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer"
xsi:noNamespaceSchemaLocation="phpcs.xsd">
<description>The coding standard for PHP_CodeSniffer itself.</description>
<file>index.php</file>
<file>src</file>
<file>templates</file>
<file>tests</file>
<file>libraries</file>
<arg name="basepath" value="." />
<arg name="colors" />
<arg name="parallel" value="75" />
<arg value="np" />
<!-- PSR12 Standard -->
<rule ref="PSR12">
<exclude name="PSR12.Files.FileHeader.SpacingAfterBlock" />
<exclude name="PSR12.Files.FileHeader.IncorrectOrder" />
<!--
Property and method names with underscore prefix are allowed in CakePHP.
Not using underscore prefix is a recommendation of PSR2, not a requirement.
-->
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
</rule>
<!-- Relax rules from PSR1 -->
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
<exclude-pattern>*/config/Migrations/*</exclude-pattern>
<exclude-pattern>*/config/Seeds/*</exclude-pattern>
</rule>
<rule ref="PSR1.Files.SideEffects">
<exclude-pattern>*/config/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="PSR1.Methods.CamelCapsMethodName">
<exclude-pattern>*/src/Model/*</exclude-pattern>
<exclude-pattern>*/src/Controller/*</exclude-pattern>
<exclude-pattern>*/src/Command/*</exclude-pattern>
<exclude-pattern>*/src/Shell/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<!-- Arrays -->
<rule ref="NormalizedArrays.Arrays.ArrayBraceSpacing" />
<rule ref="Generic.Arrays.ArrayIndent" />
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
<!-- Don't hide tokenizer exceptions -->
<rule ref="Internal.Tokenizer.Exception">
<type>error</type>
</rule>
<!-- Include some sniffs from other standards that don't conflict with PEAR -->
<rule ref="Generic.PHP.DeprecatedFunctions" />
<rule ref="Generic.Strings.UnnecessaryStringConcat" />
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing" />
<rule ref="PSR2.Classes.PropertyDeclaration" />
<rule ref="PSR2.Methods.MethodDeclaration" />
<rule ref="PSR2.Files.EndFileNewline" />
<rule ref="PSR12.Files.OpenTag" />
<rule ref="Zend.Files.ClosingTag" />
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses" />
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses" />
<!-- Only one argument per line in multi-line function calls -->
<rule ref="PEAR.Functions.FunctionCallSignature">
<properties>
<property name="allowMultipleArguments" value="false" />
</properties>
</rule>
<rule ref="Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps">
<severity>0</severity>
</rule>
<!-- Ban some functions -->
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<element key="sizeof" value="count" />
<element key="delete" value="unset" />
<element key="print" value="echo" />
<element key="create_function" value="null" />
</property>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<severity>0</severity>
</rule>
<!-- VariableAnalysis https://github.com/sirbrillig/phpcs-variable-analysis -->
<rule ref="VariableAnalysis" />
</ruleset>