Skip to content

Instantly share code, notes, and snippets.

@Jurigag
Created February 25, 2020 17:10
Show Gist options
  • Save Jurigag/81265f346e1ce51e5e6fd98a594ab0a4 to your computer and use it in GitHub Desktop.
Save Jurigag/81265f346e1ce51e5e6fd98a594ab0a4 to your computer and use it in GitHub Desktop.
ruleset.xml
<?xml version="1.0"?>
<ruleset name="IDH">
<description>The coding standard for IDH</description>
<arg name="report" value="summary"/>
<arg value="s"/>
<arg name="extensions" value="php"/>
<exclude-pattern>*/config/*</exclude-pattern>
<exclude-pattern>tests/cache/*</exclude-pattern>
<rule ref="PSR12"/>
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/ruleset.xml">
<!-- App And Cli excluded because those rules are kind of heavy we could maybe consider it on specific namespaces in app -->
<!-- Ignore cli, in most cases it doesn't matter what code is there -->
<exclude-pattern>cli/*</exclude-pattern>
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.IncorrectStrictTypesFormat" />
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.IncorrectWhitespaceBetweenOpenTagAndDeclare" />
<exclude name="SlevomatCodingStandard.Files.TypeNameMatchesFileName.NoMatchBetweenTypeNameAndFileName" />
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLineDocComment.MultiLineDocComment" />
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation.NonFullyQualifiedClassName" />
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment.MultiLinePropertyComment" />
<exclude name="SlevomatCodingStandard.Namespaces.UseOnlyWhitelistedNamespaces.NonFullyQualified" />
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified" />
<exclude name="SlevomatCodingStandard.PHP.TypeCast.InvalidCastUsed" />
<exclude name="SlevomatCodingStandard.Functions.StaticClosure.ClosureNotStatic" />
<exclude name="SlevomatCodingStandard.Functions.TrailingCommaInCall.MissingTrailingComma" />
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedExceptions.NonFullyQualifiedException" />
<exclude name="SlevomatCodingStandard.TypeHints.DisallowArrayTypeHintSyntax.DisallowedArrayTypeHintSyntax" />
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix" />
<exclude name="SlevomatCodingStandard.ControlStructures.NewWithoutParentheses.UselessParentheses" />
<exclude name="SlevomatCodingStandard.ControlStructures.RequireYodaComparison.RequiredYodaComparison" />
<exclude name="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison.DisallowedYodaComparison" />
<exclude name="SlevomatCodingStandard.ControlStructures.DisallowEmpty.DisallowedEmpty" />
<exclude name="SlevomatCodingStandard.Numbers.RequireNumericLiteralSeparator.RequiredNumericLiteralSeparator" />
<exclude name="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses" />
<exclude name="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces.NoEmptyLineBeforeClosingBrace" />
<exclude name="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition.NullTypeHintNotOnLastPosition" />
<exclude name="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces.NoEmptyLineAfterOpeningBrace" />
<exclude name="SlevomatCodingStandard.Commenting.DocCommentSpacing.IncorrectLinesCountBetweenDescriptionAndAnnotations" />
<exclude name="SlevomatCodingStandard.Files.LineLength" />
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix"/>
<exclude name="SlevomatCodingStandard.Functions.RequireArrowFunction.RequiredArrowFunction" />
</rule>
<rule ref="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing">
<properties>
<property name="tokensToCheck" type="array">
<element value="T_TRY"/>
<element value="T_IF"/>
<element value="T_DO"/>
<element value="T_WHILE"/>
<element value="T_FOR"/>
<element value="T_FOREACH"/>
<element value="T_SWITCH"/>
</property>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" value="true"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.ClassStructure">
<properties>
<property name="groups" type="array">
<element value="uses"/>
<element value="public constants"/>
<element value="protected constants"/>
<element value="private constants"/>
<element value="public properties, protected properties, private properties"/>
<element value="constructor"/>
<element value="public methods, protected methods, private methods"/>
<element value="magic methods"/>
</property>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.RequireMultiLineMethodSignature">
<properties>
<property name="minLineLength" value="141"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit">
<properties>
<property name="ignoreStandaloneIfInScope" value="true"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter">
<!-- In event handler we have many times unused $event and in repository classes we have many times different implementations -->
<exclude-pattern>modules/*EventHandler.php</exclude-pattern>
<exclude-pattern>modules/*Repository.php</exclude-pattern>
</rule>
<rule ref="Generic.Files.LineLength">
<exclude-pattern>tests/**</exclude-pattern>
<properties>
<property name="lineLimit" value="140"/>
<property name="absoluteLineLimit" value="160"/>
</properties>
</rule>
</ruleset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment