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
Using Style/HashAsLastArrayItem with EnforcedStyle: no_braces should yield valid Ruby code when there are duplicate Hashes in the array. This is similar to #8323, but has not been fully resolved when there are identical hashes in the array.
Actual behavior
The cop is not safe and results in invalid Ruby code.
$ rubocop -a hash_as_last_array_item.rbInspecting 1 fileEOffenses:hash_as_last_array_item.rb:5:3: C: [Corrected] Style/HashAsLastArrayItem: Omit the braces around the hash. { ... ^hash_as_last_array_item.rb:6:14: C: [Corrected] Style/TrailingCommaInHashLiteral: Avoid comma after the last item of a hash. foo: :bar, ^hash_as_last_array_item.rb:7:3: E: Lint/Syntax: unexpected token tCOMMA(Using Ruby 2.4 parser; configure using TargetRubyVersion parameter, under AllCops) , ^hash_as_last_array_item.rb:8:3: C: [Corrected] Style/HashAsLastArrayItem: Omit the braces around the hash. { ... ^1 file inspected, 4 offenses detected, 3 offenses corrected
Expected behavior
Using Style/HashAsLastArrayItem with EnforcedStyle: no_braces should yield valid Ruby code when there are duplicate Hashes in the array. This is similar to #8323, but has not been fully resolved when there are identical hashes in the array.
Actual behavior
The cop is not safe and results in invalid Ruby code.
Steps to reproduce the problem
RuboCop version
The text was updated successfully, but these errors were encountered: