Skip to content

Commit

Permalink
Merge pull request #2097 from WordPress/feature/core-move-rules-inclu…
Browse files Browse the repository at this point in the history
…de-require-from-extra

Core: move rules related to include/require statements from `Extra` to `Core`
  • Loading branch information
dingo-d authored Oct 28, 2022
2 parents 81d479c + e13cb6c commit a47e644
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
25 changes: 25 additions & 0 deletions WordPress-Core/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,31 @@
https://github.com/WordPress/WordPress-Coding-Standards/issues/527 -->


<!--
#############################################################################
Handbook: General - Writing include/require statements.
Ref: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#single-and-double-quotes
#############################################################################
-->

<!-- Covers rule: include[_once] and require[_once] are language constructs, they do
not need parentheses around the path, so those shouldn't be used. -->
<rule ref="PEAR.Files.IncludingFile.BracketsNotRequired"/>

<!-- Covers rule: There should only be one space between the path and the include/require keywords.
Note: the sniff covers more language constructs than just include/require. While not in the handbook,
WP Core already complies with this, so we may as well enforce it. -->
<rule ref="Generic.WhiteSpace.LanguageConstructSpacing"/>

<!-- Covers rule: It is strongly recommended to use require[_once] for unconditional includes. -->
<rule ref="PEAR.Files.IncludingFile.UseRequire">
<type>warning</type>
</rule>
<rule ref="PEAR.Files.IncludingFile.UseRequireOnce">
<type>warning</type>
</rule>


<!--
#############################################################################
Handbook: Naming - Naming Conventions.
Expand Down
17 changes: 0 additions & 17 deletions WordPress-Extra/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,6 @@
https://github.com/WordPress/WordPress-Coding-Standards/pull/809 -->
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>

<!-- And yet more best practices.
https://github.com/WordPress/WordPress-Coding-Standards/issues/1143 -->
<rule ref="PEAR.Files.IncludingFile.BracketsNotRequired">
<type>warning</type>
</rule>
<rule ref="PEAR.Files.IncludingFile.UseRequire">
<type>warning</type>
</rule>
<rule ref="PEAR.Files.IncludingFile.UseRequireOnce">
<type>warning</type>
</rule>

<!-- Check correct spacing of language constructs. This also ensures that the
above rule for not using brackets with require is fixed correctly.
https://github.com/WordPress/WordPress-Coding-Standards/issues/1153 -->
<rule ref="Generic.WhiteSpace.LanguageConstructSpacing"/>

<!-- Check that functions use all parameters passed.
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/xxx -->
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter">
Expand Down

0 comments on commit a47e644

Please sign in to comment.