You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

177 lines
7.2 KiB

<?xml version="1.0"?>
<ruleset name="Tiki Coding Standard">
<description>Tiki Coding Standard</description>
<!-- Paths to check -->
<file>.</file>
<!-- Exclude libraries and other folders that should not contain code -->
<!-- vendor folders -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/vendor_bundled/*</exclude-pattern>
<exclude-pattern>*/vendor_custom/*</exclude-pattern>
<exclude-pattern>*/vendor_extra/*</exclude-pattern>
<!-- libraries bundled with tiki -->
<exclude-pattern>*/lib/dracula/*</exclude-pattern>
<exclude-pattern>*/lib/equation/*</exclude-pattern>
<exclude-pattern>*/lib/ical/*</exclude-pattern>
<exclude-pattern>*/lib/openlayers/*</exclude-pattern>
<exclude-pattern>*/lib/sheet/excel/*</exclude-pattern>
<exclude-pattern>*/lib/sheet/include/*</exclude-pattern>
<exclude-pattern>*/lib/sheet/ole.php</exclude-pattern>
<exclude-pattern>*/lib/sheet/ole/*</exclude-pattern>
<exclude-pattern>*/lib/soap/nusoap/*</exclude-pattern>
<exclude-pattern>*/lib/tar.class.php</exclude-pattern>
<exclude-pattern>*/lib/tikihelp/js/*</exclude-pattern>
<exclude-pattern>*/lib/tikihelp/menu/*</exclude-pattern>
<exclude-pattern>*/lib/webmail/mimeDecode.php</exclude-pattern>
<exclude-pattern>*/lib/webmail/net_pop3.php</exclude-pattern>
<!-- any dot file -->
<exclude-pattern>*/\.*/*</exclude-pattern>
<!-- generated files / directories -->
<exclude-pattern>*/lang/*/language.php</exclude-pattern>
<exclude-pattern>*/lang/*/language.js</exclude-pattern>
<exclude-pattern>*/lib/test/language/fixtures/language_*</exclude-pattern>
<!-- other directories that should not contain core code -->
<!-- <exclude-pattern>*/doc/*</exclude-pattern> -->
<exclude-pattern>*/dump/*</exclude-pattern>
<exclude-pattern>*/img/*</exclude-pattern>
<exclude-pattern>*/storage/*</exclude-pattern>
<exclude-pattern>*/temp/*</exclude-pattern>
<!-- display progress -->
<arg value="p"/>
<arg name="colors"/>
<arg name="extensions" value="php"/>
<!-- Check for compatibility for PHP >= 7.4 -->
<config name="testVersion" value="7.4-"/>
<rule ref="PHPCompatibility"/>
<rule ref="PHPCompatibility.Extensions.RemovedExtensions">
<exclude-pattern>*/tiki-check.php</exclude-pattern>
</rule>
<!-- Tiki uses the Zend Coding Standards
reference: https://github.com/zendframework/zend-coding-standard/blob/master/ruleset.xml -->
<rule ref="PSR12"/>
<rule ref="Generic.Arrays.DisallowLongArraySyntax">
<exclude-pattern>*/tiki-check.php</exclude-pattern>
</rule>
<!-- latest tiki-check.php may be used to test servers with a old version of php -->
<rule ref="Generic.Arrays.DisallowShortArraySyntax">
<include-pattern>*/tiki-check.php</include-pattern>
</rule>
<rule ref="Generic.Formatting.SpaceAfterNot"/>
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<!-- Moved as override to the end of the rule set -->
<!--
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="false"/>
</properties>
</rule>
-->
<!-- Other rules to enforce the ZF standards -->
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="spacing" value="1"/>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<!-- Change severity to be able to filter if too many lines over 120 using cli option warning-severity=5 -->
<rule ref="Generic.Files.LineLength">
<severity>4</severity>
</rule>
<!-- Exceptions to PSR-2 -->
<!-- Avoid warnings in the lang files that normally have really long lines -->
<rule ref="Generic.Files.LineLength">
<exclude-pattern>*/lang/*/language.php</exclude-pattern>
</rule>
<!-- Relax some PRS-1/PSR-2 Rules to match current status.
Instead of error, these rules will return warning, and the severity is 6 so you can
display only these warning using the cli option warning-severity=6 -->
<!-- Relax PSR -->
<!-- Namespaces and classes MUST follow PSR-0.
This means each class is in a file by itself, and is in a namespace of at least one level: a top-level vendor name. -->
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
<message>Tiki PSR1 Relaxed: Each %s must be in a namespace of at least one level (a top-level vendor name)</message>
<type>warning</type>
<severity>6</severity>
</rule>
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
<message>Tiki PSR1 Relaxed: Each class must be in a file by itself</message>
<type>warning</type>
<severity>6</severity>
</rule>
<!-- Class names MUST be declared in StudlyCaps. -->
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
<message>Tiki PSR1 Relaxed: %s name "%s" is not in camel caps format</message>
<type>warning</type>
<severity>6</severity>
</rule>
<!-- Method names MUST be declared in camelCase(). -->
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<message>Tiki PSR1 Relaxed: Method name "%s" is not in camel caps format</message>
<type>warning</type>
<severity>6</severity>
</rule>
<!-- Visibility MUST be declared on all properties -->
<rule ref="PSR2.Classes.PropertyDeclaration.ScopeMissing">
<message>Tiki PSR2 Relaxed: Visibility must be declared on property "%s"</message>
<type>warning</type>
<severity>6</severity>
</rule>
<!-- The var keyword MUST NOT be used to declare a property -->
<rule ref="PSR2.Classes.PropertyDeclaration.VarUsed">
<message>Tiki PSR2 Relaxed: The var keyword must not be used to declare a property</message>
<type>warning</type>
<severity>6</severity>
</rule>
<!-- Visibility MUST be declared on all methods. -->
<rule ref="Squiz.Scope.MethodScope.Missing">
<message>Tiki PSR2 Relaxed: Visibility must be declared on method "%s"</message>
<type>warning</type>
<severity>6</severity>
</rule>
<!-- ~ PSR -->
<!-- Relax ZF Coding Standards -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax">
<message>Tiki ZF CS Relaxed: Short array syntax must be used to define arrays</message>
<type>warning</type>
<severity>6</severity>
</rule>
<!-- ~ ZF Coding Standards -->
<!-- Extra rules to improve code quality and avoid deprecated code -->
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<!--
<rule ref="Generic.Classes.DuplicateClassName"/>
<rule ref="Generic.Files.OneClassPerFile"/>
<rule ref="Generic.Files.OneInterfacePerFile"/>
<rule ref="Generic.Files.OneTraitPerFile"/>
<rule ref="Generic.PHP.BacktickOperator"/>
-->
<!-- Overrides - at the end to make sure they are applied -->
<!-- From ZF Standards -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="false"/>
</properties>
</rule>
</ruleset>