Skip to content

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

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:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions