Skip to content

Block arguments in if statements uses {, triggering Rubocop #122

Open
@renchap

Description

@renchap

Sample code after formatting using @prettier/plugin-ruby 3:

    if current_user&.admin? ||
         Rails.application.config.x.team_ips.any? { |i|
           i.include?(request.remote_ip)
         }
      Rack::MiniProfiler.authorize_request
    end

This is triggering Rubocop, even after including this gem's config:

app/controllers/application_controller.rb:62:51: C: [Correctable] Style/BlockDelimiters: Avoid using {...} for multi-line blocks.
         Rails.application.config.x.team_ips.any? { |i|

The original code (formatted by the Prettier plugin v2) cas using do … end, which did not trigger Rubocop.

I am not sure what is the correct fix here:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions