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
Fixesrubocop#10843.
This PR fix a false positive for `Style/HashExcept` when using
`reject` and calling `include?` method with symbol array and
second block value.
Fixesrubocop#10843.
This PR fix a false positive for `Style/HashExcept` when using
`reject` and calling `include?` method with symbol array and
second block value.
The Style/HashExcept rule wants to turn:
{ foo: 1, bar: 2, baz: 3 }.reject { |_, v| [1, 2].include?(v) }
into the nonequivalent
{ foo: 1, bar: 2, baz: 3 }.except(1, 2)
Expected behavior
Perhaps nothing, since we're using the second, value param of the
reject
block. All of the examples show using the first, key param.Actual behavior
rubocop
andrubocop -a
want to suggest{ foo: 1, bar: 2, baz: 3 }.except(1, 2)
Steps to reproduce the problem
{ foo: 1, bar: 2, baz: 3 }.reject { |_, v| [1, 2].include?(v) }
rubocop -a
{ foo: 1, bar: 2, baz: 3 }.except(1, 2)
RuboCop version
1.32.0 (using Parser 3.1.2.0, rubocop-ast 1.19.1, running on ruby 3.1.2 x86_64-linux-musl)
The text was updated successfully, but these errors were encountered: