Skip to content

Rails/Pluck doesn't work inside blocks #1505

@vlad-pisanov

Description

@vlad-pisanov

Consider:

list.map { |x| x['key'] }    # Rails/Pluck suggests list.pluck('key') ✔️ 

foo do
  list.map { |x| x['key'] }  # Rails/Pluck doesn't detect an offense ❌ 
end
1.79.2 (using Parser 3.3.9.0, Prism 1.4.0, rubocop-ast 1.46.0, analyzing as Ruby 3.3, running on ruby 3.3.2) [x86_64-darwin24]
  - rubocop-minitest 0.38.1
  - rubocop-performance 1.25.0
  - rubocop-rails 2.32.0
  - rubocop-factory_bot 2.27.1

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