Skip to content

Disable Style/EmptyCaseCondition cop#787

Open
ramhoj wants to merge 1 commit intostandardrb:mainfrom
ramhoj:disable-empty-case-condition
Open

Disable Style/EmptyCaseCondition cop#787
ramhoj wants to merge 1 commit intostandardrb:mainfrom
ramhoj:disable-empty-case-condition

Conversation

@ramhoj
Copy link

@ramhoj ramhoj commented Feb 3, 2026

The Style/EmptyCaseCondition cop enforces converting empty case statements to if/elsif chains. However, both styles are equally readable and the case-when style is often preferred by developers when expressing multiple conditional branches that return values.

Example of now-allowed code:

    case
    when done? then :done
    when exception? then :exception
    else :processing
    end

Fixes #229.

The `Style/EmptyCaseCondition` cop enforces converting empty case
statements to if/elsif chains. However, both styles are equally
readable and the case-when style is often preferred by developers
when expressing multiple conditional branches that return values.

Example of now-allowed code:

    case
    when done?       then :done
    when exception?  then :exception
    else :processing
    end

Fixes standardrb#229

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider disabling Style/EmptyCaseCondition

1 participant