From d8cf58e06d935cb7cf6b61377cd422e8d01f7676 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 20 Jul 2023 11:26:39 +0200 Subject: [PATCH] Extra: add sniff to discourage the use of "long" closures Loosely related to the discussion in 1486. This adds a new sniff to the `WordPress-Extra` ruleset to discourage (`warning`) the use of "long" closures. By default, the sniff will _warn_ when a closure exceeds 5 lines and throw an error when the closure exceeds 8 lines, though these numbers are configurable. By default, the sniff will only count code lines when determining the closure length and will ignore comment-only and blank lines. As the intention is to only discourage long closures, the error has been disabled (by setting it to a really high value). Ref: PHPCSStandards/PHPCSExtra 240 --- :point_right: To discuss: should the value for the `recommendedLines` property stay at `5` (sniff default) or do we want to use a different value ? --- WordPress-Extra/ruleset.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/WordPress-Extra/ruleset.xml b/WordPress-Extra/ruleset.xml index b3685b7c37..b1c94db33a 100644 --- a/WordPress-Extra/ruleset.xml +++ b/WordPress-Extra/ruleset.xml @@ -174,6 +174,15 @@ + + + + + + + + +