Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra: add sniff to discourage the use of "long" closures #2311

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Commits on Jul 20, 2023

  1. 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 ?
    jrfnl committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    d8cf58e View commit details
    Browse the repository at this point in the history