Skip to content

Commit

Permalink
Merge pull request #360 from Yoast/JRF/yoastcs-more-generic-rules
Browse files Browse the repository at this point in the history
YoastCS: add more generic rules
  • Loading branch information
jrfnl authored Dec 14, 2023
2 parents a083401 + 5d3ffad commit 340b3a2
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Yoast/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,20 @@
<!-- PHPCS 3.5.0: This sniff may be added to WPCS in due time and can then be removed from this ruleset. -->
<rule ref="PSR12.Files.OpenTag"/>

<!-- CS: Enforces that a PHP open tag uses lowercase. -->
<!-- PHPCSExtra 1.2.0: This sniff may be added to WPCS in due time and can then be removed from this ruleset. -->
<rule ref="Universal.PHP.LowercasePHPTag"/>

<!-- Demand that "else(if)" is on a new line after the scope closer of the preceding if. -->
<rule ref="Universal.ControlStructures.IfElseDeclaration"/>

<!-- CS: Forbid the use of alternative control structure syntax, except in combination with inline HTML. -->
<rule ref="Universal.ControlStructures.DisallowAlternativeSyntax">
<properties>
<property name="allowWithInlineHTML" value="true"/>
</properties>
</rule>

<!-- Error prevention: Make sure the condition in a inline if declaration is bracketed. -->
<rule ref="Squiz.ControlStructures.InlineIfDeclaration"/>

Expand All @@ -185,6 +196,12 @@
</properties>
</rule>

<!-- CS/QA: Forbid the use of the and/or logical operators. -->
<rule ref="Universal.Operators.DisallowLogicalAndOr"/>

<!-- CS/QA: Forbid the use double `!`. -->
<rule ref="Universal.CodeAnalysis.NoDoubleNegative"/>

<!-- CS: enforce that boolean operators between conditions in multi-line control structures are
consistently at the start or end of the line, not a mix of both. -->
<rule ref="PSR12.ControlStructures.BooleanOperatorPlacement">
Expand All @@ -194,6 +211,16 @@
</properties>
</rule>

<!-- CS: enforce that concatenation operators in multi-line concatenations are
consistently at the start of the line. -->
<rule ref="Universal.Operators.ConcatPosition"/>

<!-- CS/QA: Disallow implicit array creation. -->
<rule ref="SlevomatCodingStandard.Arrays.DisallowImplicitArrayCreation"/>

<!-- CS/QA: Enforce static closures when a closure doesn't access $this. -->
<rule ref="SlevomatCodingStandard.Functions.StaticClosure"/>


<!--
#############################################################################
Expand Down

0 comments on commit 340b3a2

Please sign in to comment.