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

[Fix #10147] Fix Lint/ElseLayout for else nodes with a single line body #10192

Closed
wants to merge 1 commit into from
Closed

[Fix #10147] Fix Lint/ElseLayout for else nodes with a single line body #10192

wants to merge 1 commit into from

Commits on Oct 16, 2021

  1. [Fix #10147] Fix Lint/ElseLayout for else nodes with a single line …

    …body
    
    The ElseLayout cop, in spirit, is trying to prevent accidentally using
    else when a user meant to use elsif based on the fact that they used
    else in a similar way as elsif (by passing an argument to it).
    
    However; the syntax of having a compact single line else statement with
    no other body is valid and likely shouldn't be flagged as problematic.
    
    This commit stops ElseLayout cop from reporting an offense when all the
    else branch's children are on the same line as the else node itself,
    while still reporting errors if there are children on other lines in the
    else branch (which is likely a mistake)
    jkeck committed Oct 16, 2021
    Configuration menu
    Copy the full SHA
    30ccc14 View commit details
    Browse the repository at this point in the history