Closed
Description
Expected behavior
Given the original code:
players.
map(&:score).
compact.
max
I expect rubocop -A --only Performance/MapCompact
to correct the code to
players.
filter_map(&:score).
max
Actual behavior
Instead, rubocop -A --only Performance/MapCompact
corrects the code to
players.
filter_map(&:score)
max
which ultimately results in
undefined local variable or method `max' for main:Object (NameError)
RuboCop version
$ bundle exec rubocop -V
1.14.0 (using Parser 3.0.1.1, rubocop-ast 1.5.0, running on ruby 2.7.3 x86_64-darwin19)
- rubocop-performance 1.11.3