Skip to content

Commit

Permalink
OneObjectStructurePerFile: move from Extra to Core
Browse files Browse the repository at this point in the history
Per the discussion had on Slack about this initiated by GaryJones.
WP Core currently has 27 violations against this rule.

In `Extra` the error message was changed and downgraded to a `warning`.

Now the sniff will be added to `Core`, per this PR, the:
* Message text will still be changed a little to be clearer, but will be stricter.
* The message will be an `error` and not be downgraded to a `warning`.

To do:
- [ ] Add a rule to this effect to the handbook.
  • Loading branch information
jrfnl committed Apr 9, 2021
1 parent 0bb2688 commit 88c5608
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 6 additions & 0 deletions WordPress-Core/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,12 @@
<severity>0</severity>
</rule>

<!-- Encourage having only one class/interface/trait per file.
Moved from Extra to Core after discussion on Slack. -->
<rule ref="Generic.Files.OneObjectStructurePerFile">
<message>Best practices: Declare only one class/interface/trait in a file.</message>
</rule>

<!--
#############################################################################
Not in the coding standard handbook: WP specific sniffs.
Expand Down
6 changes: 0 additions & 6 deletions WordPress-Extra/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@
<!-- https://github.com/WordPress/WordPress-Coding-Standards/pull/382#discussion_r29981655 -->
<!--<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>-->

<!-- Encourage having only one class/interface/trait per file. -->
<rule ref="Generic.Files.OneObjectStructurePerFile">
<type>warning</type>
<message>Best practice suggestion: Declare only one class/interface/trait in a file.</message>
</rule>

<!-- Verify modifier keywords for declared methods and properties in classes.
https://github.com/WordPress/WordPress-Coding-Standards/issues/1101 -->
<rule ref="Squiz.Scope.MethodScope"/>
Expand Down

0 comments on commit 88c5608

Please sign in to comment.