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#7831.
This PR fix a false positive for `Style/HashEachMethods` when there is no
receiver for `keys` and `values`.
The following is an examples.
```ruby
values.each { |k, v| do_something(k, v) }
keys.each { |k, v| do_something(k, v) }
```
False negatives occur in cases such as object that inherit Hash,
but that is perhaps a corner case.
I think it is more worthwhile to resolve the false positives with
common naming of `values`.
Fixes#7831.
This PR fix a false positive for `Style/HashEachMethods` when there is no
receiver for `keys` and `values`.
The following is an examples.
```ruby
values.each { |k, v| do_something(k, v) }
keys.each { |k, v| do_something(k, v) }
```
False negatives occur in cases such as object that inherit Hash,
but that is perhaps a corner case.
I think it is more worthwhile to resolve the false positives with
common naming of `values`.
I have code like this:
Expected behavior
No error is raised by Style/HashEachMethods.
Actual behavior
Steps to reproduce the problem
Run RuboCop on the code snippet.
RuboCop version
The text was updated successfully, but these errors were encountered: