OneObjectStructurePerFile: move from Extra to Core

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.
This commit is contained in:
jrfnl 2019-09-22 19:58:33 +02:00
parent 0bb2688c53
commit 88c56085b9
2 changed files with 6 additions and 6 deletions

View file

@ -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.

View file

@ -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"/>