You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running RuboCop on the sample code attached below, Performance/RedundantMerge cop is failing.
Expected behavior
RuboCop checks the code correctly.
Actual behavior
The following error is shown (when running with -d option):
An error occurred while Performance/RedundantMerge cop was inspecting /home/eyusupov/toptal/toptal/1.rb.
undefined method `name' for #<Parser::Source::Map::Send:0x005605c56b9bc8>
/home/eyusupov/sources/rubocop/lib/rubocop/cop/performance/redundant_merge.rb:31:in `block in on_send'
/home/eyusupov/sources/rubocop/lib/rubocop/cop/performance/redundant_merge.rb:19:in `redundant_merge'
/home/eyusupov/sources/rubocop/lib/rubocop/cop/performance/redundant_merge.rb:25:in `on_send'
/home/eyusupov/sources/rubocop/lib/rubocop/cop/commissioner.rb:42:in `block (2 levels) in on_send'
Make sure the receiver for `merge!` inside `each_with_object` is a
local variable. This prevents the following from crashing:
t.each_with_object({}) { |_, r| r[:a].merge!(a: '') }
When running RuboCop on the sample code attached below,
Performance/RedundantMerge
cop is failing.Expected behavior
RuboCop checks the code correctly.
Actual behavior
The following error is shown (when running with
-d
option):Steps to reproduce the problem
Create a Ruby file with the following code:
Run RuboCop on this file.
RuboCop version
The text was updated successfully, but these errors were encountered: