We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When using reject with an array variable to exclude keys from hash, the suggestion is wrong.
some_var = [:foo, :baz] {foo: 1, bar: 2, baz: 3}.reject { |k, _v| k.include?(some_var) }
Expected message:
Use `except(*some_var)` instead. (convention:Style/HashExcept)
Use `except(some_var)` instead. (convention:Style/HashExcept)
some_var = [:foo, :baz] {foo: 1, bar: 2, baz: 3}.reject { |k, _v| k.include?(some_var) } # {bar: 2} {foo: 1, bar: 2, baz: 3}.except(some_var) # {foo: 1, bar: 2, baz: 3} {foo: 1, bar: 2, baz: 3}.except(*some_var) # {bar: 2}
$ bundle exec rubocop -V 1.31.0 (using Parser 3.1.2.0, rubocop-ast 1.18.0, running on ruby 3.1.0 x86_64-darwin20) - rubocop-graphql 0.14.3 - rubocop-performance 1.14.2 - rubocop-rails 2.15.0 - rubocop-rake 0.6.0 - rubocop-rspec 2.11.1
The text was updated successfully, but these errors were encountered:
related PR #10699
Sorry, something went wrong.
[Fix rubocop#10754] Fix an incorrect autocorrect for Style/HashExcept
Style/HashExcept
82d3ebf
Fixes rubocop#10754. This PR fixes an incorrect autocorrect for `Style/HashExcept` when using a non-literal collection receiver for `include?`.
[Fix #10754] Fix an incorrect autocorrect for Style/HashExcept
f5b77c8
Fixes #10754. This PR fixes an incorrect autocorrect for `Style/HashExcept` when using a non-literal collection receiver for `include?`.
Successfully merging a pull request may close this issue.
When using reject with an array variable to exclude keys from hash, the suggestion is wrong.
Expected behavior
Expected message:
Actual behavior
Steps to reproduce the problem
RuboCop version
The text was updated successfully, but these errors were encountered: