Skip to content

Instantly share code, notes, and snippets.

@dionedomingo
Last active November 30, 2020 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dionedomingo/5d22255488ba72ce6626020de5755b1b to your computer and use it in GitHub Desktop.
Save dionedomingo/5d22255488ba72ce6626020de5755b1b to your computer and use it in GitHub Desktop.
Iposen CodeSniffer Codeing standard ruleset for VSCode and PHPStorm S
<?xml version="1.0"?>
<ruleset name="OrderAssistent">
<rule ref="Squiz.WhiteSpace.OperatorSpacing.NoSpaceBefore"></rule>
<rule ref="Squiz.Formatting.OperatorBracket.MissingBrackets"></rule>
<rule ref="Squiz.Arrays.ArrayDeclaration.NoSpaceAfterComma"></rule>
</ruleset>
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_iPosen" xsi:noNamespaceSchemaLocation="../../../phpcs.xsd">
<description>iPosen coding standards</description>
<!--
IMPORTANT!
iPosen Ruleset is still a work in progress
-->
<!-- Include the whole Squiz standard except FunctionComment, which we override -->
<rule ref="Squiz">
<exclude name="Squiz.Files.FileExtension.ClassFound"/>
<exclude name="Squiz.NamingConventions.ValidVariableName.NotCamelCaps"/>
<exclude name="Squiz.Commenting.ClosingDeclarationComment.Missing" />
<exclude name="Squiz.Classes.ClassDeclaration.OpenBraceNewLine" />
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
<exclude name="Squiz.NamingConventions.ValidFunctionName.ScopeNotCamelCaps" />
<exclude name="Squiz.PHP.DisallowInlineIf.Found" />
<exclude name="Squiz.PHP.DisallowComparisonAssignment.AssignedComparison" />
<exclude name="Squiz.Classes.ClassFileName.NoMatch" />
<exclude name="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue" />
<exclude name="Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps" />
<exclude name="Squiz.WhiteSpace.FunctionSpacing.AfterLast" />
<exclude name="Squiz.WhiteSpace.FunctionSpacing.Before" />
<exclude name="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed" />
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing" />
<exclude name="Squiz.WhiteSpace.FunctionClosingBraceSpace.SpacingBeforeClose" />
<!-- TEMPORARY -->
<exclude name="Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure" />
<exclude name="Squiz.Scope.MethodScope.Missing" />
<exclude name="Squiz.Commenting.FunctionComment.Missing" />
<exclude name="Squiz.Scope.MethodScope.Missing" />
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
<exclude name="Squiz.Commenting.InlineComment.NotCapital" />
<exclude name="Squiz.NamingConventions.ValidFunctionName.NotCamelCaps" />
<exclude name="Squiz.Operators.ComparisonOperatorUsage.NotAllowed" />
<exclude name="Squiz.WhiteSpace.LogicalOperatorSpacing.TooMuchSpaceAfter" />
<exclude name="Squiz.Commenting.VariableComment.Missing" />
<exclude name="Squiz.ControlStructures.ElseIfDeclaration.NotAllowed" />
<exclude name="Squiz.Commenting.FileComment.SubpackageTagOrder" />
<exclude name="Squiz.Commenting.FileComment.PackageTagOrder" />
<exclude name="Squiz.Commenting.FileComment.IncorrectAuthor" />
<exclude name="Squiz.Strings.DoubleQuoteUsage.NotRequired" />
<exclude name="Squiz.Commenting.PostStatementComment.Found" />
<exclude name="Squiz.WhiteSpace.MemberVarSpacing.AfterComment" />
<exclude name="Squiz.WhiteSpace.FunctionSpacing.After" />
<exclude name="Squiz.NamingConventions.ValidVariableName.StringNotCamelCaps" />
<exclude name="Generic.Arrays.ArrayIndent.KeyIncorrect" />
<exclude name="Squiz.NamingConventions.ValidVariableName.PublicHasUnderscore" />
<exclude name="PEAR.NamingConventions.ValidVariableName.PublicUnderscore" />
<exclude name="Squiz.ControlStructures.InlineIfDeclaration.NoBrackets" />
<exclude name="Squiz.PHP.DisallowComparisonAssignment.AssignedBool" />
<!-- File Comment -->
<exclude name="Squiz.Commenting.LongConditionClosingComment.Missing" />
<exclude name="Squiz.Commenting.FileComment.MissingPackageTag" />
<exclude name="Squiz.Commenting.FileComment.MissingSubpackageTag" />
<exclude name="PEAR.Commenting.FileComment.MissingCategoryTag" />
<exclude name="PEAR.Commenting.FileComment.MissingPackageTag" />
<exclude name="PEAR.Commenting.FileComment.MissingLicenseTag" />
<exclude name="PEAR.Commenting.ClassComment.MissingAuthorTag" />
<exclude name="PEAR.Commenting.ClassComment.MissingLinkTag" />
<exclude name="Squiz.ControlStructures.SwitchDeclaration.SpacingAfterBreak" />
<exclude name="Squiz.PHP.CommentedOutCode.Found" />
<exclude name="Squiz.Commenting.InlineComment.NoSpaceBefore" />
<!-- Conflicts -->
<exclude name="Generic.Commenting.DocComment.SpacingAfter" />
</rule>
<!-- Private properties MUST not be prefixed with an underscore -->
<rule ref="PSR2.Classes.PropertyDeclaration.Underscore">
<type>error</type>
</rule>
<!-- Private methods MUST not be prefixed with an underscore -->
<rule ref="PSR2.Methods.MethodDeclaration.Underscore">
<type>error</type>
</rule>
<rule ref="PSR2">
<exclude name="PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose"/>
<exclude name="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody" />
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
<exclude name="Generic.Files.LineLength"/>
<exclude name="Generic.WhiteSpace.DisallowTabIndent.TabsUsed"/>
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpaceBeforeCloseBrace" />
<!-- Maybe remove at some point -->
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSame" />
<exclude name="Generic.PHP.ForbiddenFunctions.Found" />
<exclude name="Generic.WhiteSpace.DisallowTabIndent.NonIndentTabsUsed" />
<exclude name="Generic.Arrays.DisallowLongArraySyntax.Found" />
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect" />
<exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact" />
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine" />
<exclude name="PEAR.ControlStructures.MultiLineCondition.SpacingAfterOpenBrace" />
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace" />
<!-- Too many of these in source-->
<exclude name="Squiz.Objects.ObjectInstantiation.NotAssigned" />
</rule>
<rule ref="PHPCompatibility" />
<rule ref="PEAR" >
<exclude name="PEAR.Functions.FunctionDeclaration.BraceOnSameLine" />
<exclude name="PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps" />
<!-- Maybe remove at some point -->
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" />
<exclude name="PEAR.NamingConventions.ValidFunctionName.NotCamelCaps" />
<exclude name="PEAR.Commenting.FunctionComment.Missing" />
<exclude name="PEAR.ControlStructures.ControlSignature.Found" />
<exclude name="PEAR.Commenting.FileComment.MissingVersion" />
<exclude name="PEAR.NamingConventions.ValidVariableName.PrivateNoUnderscore" />
<!-- Duplicated -->
<exclude name="PEAR.WhiteSpace.ScopeIndent.IncorrectExact" />
<exclude name="PEAR.WhiteSpace.ScopeIndent.Incorrect" />
<exclude name="PEAR.Classes.ClassDeclaration.OpenBraceNewLine"/>
<!-- Class Comment meta-->
<exclude name="PEAR.Commenting.ClassComment.MissingCategoryTag" />
<exclude name="PEAR.Commenting.ClassComment.MissingPackageTag"/>
<exclude name="PEAR.Commenting.ClassComment.MissingLicenseTag" />
<exclude name="Squiz.Commenting.FileComment.Missing" />
<exclude name="PEAR.Commenting.FileComment.Missing" />
<exclude name="Squiz.Commenting.ClassComment.Missing" />
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
<exclude name="PEAR.Commenting.ClassComment.Missing" />
<exclude name="Squiz.WhiteSpace.ScopeClosingBrace.Indent" />
<exclude name="Squiz.ControlStructures.SwitchDeclaration.BreakIndent" />
</rule>
<!-- Ignore sch views temporary -->
<rule ref="PEAR.Commenting.FileComment.Missing">
<exclude-pattern>view/*\.php</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FileComment.Missing">
<exclude-pattern>view/*\.php</exclude-pattern>
</rule>
<!-- Too many errors in these files.-->
<!-- Everything below here is just because these files are just crazy too many errors thrown.-->
<rule ref="Generic.Commenting.DocComment.SpacingBeforeTags">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
</rule>
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/systems/api/modules/payment/payment_controller.php</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.InlineComment.NoSpaceBefore">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
</rule>
<rule ref="Squiz.PHP.LowercasePHPFunctions.CallUppercase">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
</rule>
<rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/systems/api/modules/payment/payment_controller.php</exclude-pattern>
</rule>
<rule ref="PEAR.ControlStructures.MultiLineCondition.SpaceBeforeOpenBrace">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/systems/api/modules/payment/payment_controller.php</exclude-pattern>
</rule>
<rule ref="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
</rule>
<rule ref="Squiz.WhiteSpace.MemberVarSpacing.FirstIncorrect">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
</rule>
<rule ref="Squiz.WhiteSpace.MemberVarSpacing.Incorrect">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/systems/api/modules/payment/payment_controller.php</exclude-pattern>
</rule>
<rule ref="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
</rule>
<rule ref="Squiz.Strings.ConcatenationSpacing.PaddingFound">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/systems/api/modules/payment/payment_controller.php</exclude-pattern>
</rule>
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceAfterOpenBracket">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
</rule>
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
</rule>
<rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/systems/api/modules/payment/payment_controller.php</exclude-pattern>
</rule>
<rule ref="Generic.PHP.ForbiddenFunctions.FoundWithAlternative">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
</rule>
<rule ref="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned">
<exclude-pattern>iposen.dk/lib/orderassistent_helper\.php</exclude-pattern>
<exclude-pattern>iposen.dk/systems/api/modules/billing/billing_controller\.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
<exclude-pattern>iposendk/iposen.dk/systems/api/modules/payment/payment_controller.php</exclude-pattern>
</rule>
<rule ref="Squiz.ControlStructures.InlineIfDeclaration.NoBrackets">
<exclude-pattern>iposendk/iposen.dk/lib/shopassistant.php</exclude-pattern>
</rule>
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose">
<exclude-pattern>iposendk/iposen.dk/systems/api/modules/payment/payment_controller.php</exclude-pattern>
</rule>
<rule ref="Squiz.ControlStructures.SwitchDeclaration.EmptyDefault">
<exclude-pattern>iposendk/iposen.dk/systems/api/modules/payment/payment_controller.php</exclude-pattern>
</rule>
<!-- <rule ref="./orderassistent_helper.xml" scope="iposen.dk/lib"/> -->
</ruleset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment