Skip to content

Style/BlockDelimiters (semantic) false positive when used in case #13720

@tylerhunt

Description

@tylerhunt

Expected behavior

When using:

Style/BlockDelimiters:
  EnforcedStyle: semantic

The following code should be valid:

case hash.detect { |_, value| value }
in [key, _] then key
end

Actual behavior

Fails with the following offense:

block_delimiters_false_positive.rb:3:18: C: [Correctable] Style/BlockDelimiters: Prefer do...end over {...} for procedural blocks.
case hash.detect { |_, value| value }
                 ^

Steps to reproduce the problem

Configure Rubocop as above and use the example shown.

RuboCop version

1.70.0 (using Parser 3.3.7.0, rubocop-ast 1.37.0, analyzing as Ruby 3.3, running on ruby 3.3.4) [arm64-darwin23]
  - rubocop-capybara 2.21.0
  - rubocop-rails 2.25.1
  - rubocop-rspec 3.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions