Skip to content

Commit

Permalink
Update phpcs ruleset
Browse files Browse the repository at this point in the history
  • Loading branch information
mducharme committed Oct 15, 2018
1 parent d18046b commit d5d28af
Showing 1 changed file with 51 additions and 36 deletions.
87 changes: 51 additions & 36 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Charcoal">
<description>Charcoal Coding Standard</description>

Expand All @@ -10,7 +10,7 @@

<rule ref="PSR2" />

<!-- Array Sniffs -->
<!-- Array Sniffs -->

<!-- Ensures short-array notation. -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
Expand All @@ -19,7 +19,7 @@
<!-- Ensures array declaration is standard. Disabled because of weird spacing requirement. -->
<!--<rule ref="Squiz.Arrays.ArrayDeclaration" />-->

<!-- Classes Sniffs -->
<!-- Classes Sniffs -->

<!-- Classes with duplicate names are not allowed -->
<rule ref="Generic.Classes.DuplicateClassName" />
Expand All @@ -36,7 +36,7 @@
<!-- Test class names are camel-cased properly -->
<rule ref="Squiz.Classes.ValidClassName" />

<!-- Code Analysis Sniffs -->
<!-- Code Analysis Sniffs -->

<!-- Do not allow empty if, else or case -->
<rule ref="Generic.CodeAnalysis.EmptyStatement" />
Expand All @@ -57,7 +57,7 @@
<!-- This sniff class detects empty statement. -->
<rule ref="Generic.CodeAnalysis.EmptyStatement" />

<!-- Commenting Sniffs -->
<!-- Commenting Sniffs -->

<!-- Detect "fixme" comments and warn -->
<rule ref="Generic.Commenting.Fixme" />
Expand All @@ -67,6 +67,8 @@
<!-- @todo Doc me -->
<!--<rule ref="PEAR.Commenting.FileComment.Missing" />-->
<!-- @todo Doc me -->
<!--<rule ref="PEAR.Commenting.ClassComment" />-->
<!-- @todo Doc me -->
<!--<rule ref="PEAR.Commenting.FunctionComment.Missing" />-->
<!-- Block comments should be used appropriately -->
<!--<rule ref="Squiz.Commenting.BlockComment" />-->
Expand All @@ -92,10 +94,14 @@
<!--<rule ref="Squiz.Commenting.LongConditionClosingComment" />-->
<!-- Checks to ensure that there are no comments after statements (on same line, after ;) -->
<rule ref="Squiz.Commenting.PostStatementComment" />
<rule ref="Squiz.Commenting.PostStatementComment.Found">
<type>warning</type>
<message>Comments should not appear after statements</message>
</rule>
<!-- Variable commenting rules -->
<rule ref="Squiz.Commenting.VariableComment" />

<!-- Control Structures Sniffs -->
<!-- Control Structures Sniffs -->

<!-- Inline controls (IF, ELSE, FOR, WHILE) must have brackets -->
<rule ref="Generic.ControlStructures.InlineControlStructure" />
Expand All @@ -108,17 +114,12 @@
<!-- Verifies that there is a space between each condition of FOR loops -->
<rule ref="Squiz.ControlStructures.ForLoopDeclaration" />
<!-- Tests the spacing of shorthand IF statements -->
<rule ref="Squiz.ControlStructures.InlineIfDeclaration" />
<!-- Allow inline shorthand IF statements to be declared on multiple lines -->
<rule ref="Squiz.ControlStructures.InlineIfDeclaration.NotSingleLine">
<!-- This returns false-positive; hide them -->
<severity>0</severity>
</rule>
<!--<rule ref="Squiz.ControlStructures.InlineIfDeclaration" />-->
<!-- Ensures all control structure keywords are lowercase -->
<rule ref="Squiz.ControlStructures.LowercaseDeclaration" />
<!--<rule ref="Squiz.ControlStructures.SwitchDeclaration" />-->

<!-- Files Sniffs -->
<!-- Files Sniffs -->

<!-- A simple sniff for detecting BOMs that may corrupt application work -->
<rule ref="Generic.Files.ByteOrderMark" />
Expand All @@ -145,7 +146,7 @@
<!-- Checks that all file names are lowercased. Incompatible with PSR. -->
<!--<rule ref="Generic.Files.LowercasedFilename" />-->

<!-- Formatting Sniffs -->
<!-- Formatting Sniffs -->

<!-- Do not allow multiple PHP statements (;) on a same line -->
<rule ref="Generic.Formatting.DisallowMultipleStatements" />
Expand All @@ -160,7 +161,7 @@
<!-- Tests that all arithmetic operations are bracketed. -->
<rule ref="Squiz.Formatting.OperatorBracket" />

<!-- Functions Sniffs -->
<!-- Functions Sniffs -->

<!-- Ensures that variables are not passed by reference when calling a function -->
<rule ref="Generic.Functions.CallTimePassByReference" />
Expand All @@ -174,7 +175,7 @@
<!-- Checks that arguments in function declarations are spaced correctly. -->
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1"/>
<property name="equalsSpacing" value="1" />
</properties>
</rule>
<!-- @todo doc me -->
Expand All @@ -189,11 +190,11 @@
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration" />
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction">
<!-- This check is disabled; it breaks lambda functions -->
<severity>0></severity>
<severity>0</severity>
</rule>
<rule ref="PEAR.Functions.ValidDefaultValue" />

<!-- Metrics Sniffs -->
<!-- Metrics Sniffs -->

<!--
Generic.Metrics_CyclomaticComplexity
Expand All @@ -205,7 +206,7 @@
absoluteNestingLevel
-->

<!-- Naming Conventions Sniffs -->
<!-- Naming Conventions Sniffs -->

<!-- @todo Doc -->
<!--<rule ref="Generic.NamingConventions.CamelCapsFunctionName" /> -->
Expand All @@ -214,13 +215,14 @@
<!-- All constants should be uppercase -->
<rule ref="Generic.NamingConventions.UpperCaseConstantName" />

<!-- Objects Sniffs -->
<!-- Objects Sniffs -->

<!-- Ensures objects are assigned to a variable when instantiated. -->
<!--<rule ref="Squiz.Objects.ObjectInstantiation" />-->

<rule ref="Squiz.Objects.ObjectInstantiation">
<exclude name="Squiz.Objects.ObjectInstantiation.NotAssigned" />
</rule>

<!-- Operators Sniffs -->
<!-- Operators Sniffs -->

<!-- Force === operator instead of implicit true if(x) or false if(!x) -->
<!--<rule ref="Squiz.Operators.ComparisonOperatorUsage" />-->
Expand All @@ -229,7 +231,7 @@
<!-- Disallow "and" and "or". Use && and || instead -->
<rule ref="Squiz.Operators.ValidLogicalOperators" />

<!-- PHP Sniffs -->
<!-- PHP Sniffs -->

<!-- Checks that the opening PHP tag is the first content in a file -->
<!--<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag" />-->
Expand Down Expand Up @@ -260,8 +262,8 @@
<!-- Disallow inline IF DISABLED -->
<!--<rule ref="Squiz.PHP.DisallowInlineIf" />-->

<rule ref="Squiz.PHP.DisallowMultipleAssignments" />
<rule ref="Squiz.PHP.DisallowObEndFlush" />
<!-- Disabled: CSV reading is best done with assigment on while... -->
<!--<rule ref="Squiz.PHP.DisallowMultipleAssignments" />-->
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops" />
<!-- @todo Doc me -->
<rule ref="Squiz.PHP.DiscouragedFunctions" />
Expand All @@ -270,16 +272,14 @@
<severity>0</severity>
</rule>
<rule ref="Squiz.PHP.Eval" />
<!-- Disallow usage of functions that should be obsolete but kept for compatibility. -->
<rule ref="Squiz.PHP.ForbiddenFunctions" />
<rule ref="Squiz.PHP.GlobalKeyword" />
<rule ref="Squiz.PHP.Heredoc" />
<rule ref="Squiz.PHP.InnerFunctions" />
<rule ref="Squiz.PHP.LowercasePHPFunctions" />
<!-- Warns of code that will never be reached DISABLED-->
<rule ref="Squiz.PHP.NonExecutableCode" />

<!-- Scope Sniffs -->
<!-- Scope Sniffs -->

<!-- Verifies that class members have scope modifiers. -->
<rule ref="Squiz.Scope.MemberVarScope" />
Expand All @@ -289,23 +289,39 @@
<rule ref="Squiz.Scope.StaticThisUsage" />


<!-- Strings Sniffs -->
<!-- Strings Sniffs -->

<!-- Use one string instead of concatenating 2 strings together -->
<rule ref="Generic.Strings.UnnecessaryStringConcat" />
<rule ref="Generic.Strings.UnnecessaryStringConcat">
<properties>
<property name="allowMultiline" value="true" />
</properties>
</rule>
<rule ref="Generic.Strings.UnnecessaryStringConcat.Found">
<type>warning</type>
<message>Only concatenate strings if they would be too long on a single line.</message>
</rule>
<!-- Makes sure there are no spaces between the concatenation operator (.) the strings -->
<rule ref="Squiz.Strings.ConcatenationSpacing" />
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="ignoreNewlines" value="true" />
</properties>
</rule>
<rule ref="Squiz.Strings.ConcatenationSpacing.PaddingFound">
<type>warning</type>
<message>Concat operator should not be surrounded by spaces</message>
</rule>
<!-- Makes sure that any use of Double Quotes ("") are warranted. -->
<rule ref="Squiz.Strings.DoubleQuoteUsage" />
<!-- Makes sure that any strings that are "echoed" are not enclosed in brackets -->
<rule ref="Squiz.Strings.EchoedStrings" />

<!-- Version Control Sniffs -->
<!-- Version Control Sniffs -->

<!-- Tests that the correct Subversion properties are set -->
<rule ref="Generic.VersionControl.SubversionProperties" />

<!-- White Space Sniffs -->
<!-- White Space Sniffs -->

<!-- Throws errors if spaces are used for indentation -->
<!--<rule ref="Generic.WhiteSpace.DisallowSpaceIndent" />-->
Expand All @@ -316,7 +332,7 @@
<!-- There MUST NOT be trailing whitespace at the end of non-blank lines. -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="true"/>
<property name="ignoreBlankLines" value="true" />
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">
Expand All @@ -328,5 +344,4 @@
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
<severity>0</severity>
</rule>

</ruleset>

0 comments on commit d5d28af

Please sign in to comment.