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
I have code:
{}.reject { |_k, v| v.count.eql? 1 }
and the Style/HashExcept rule changes this to invalid and non-equivalent code:
{}.except(v.count)
The Style/HashExcept rule should not trigger.
% rubocop --debug For /Users/tobyaw/Desktop/test: configuration from /Users/tobyaw/Desktop/test/.rubocop.yml Default configuration from /usr/local/lib/ruby/gems/3.0.0/gems/rubocop-1.19.1/config/default.yml Use parallel by default. Running parallel inspection Inspecting 1 file Scanning /Users/tobyaw/Desktop/test/test.rb Loading cache from /Users/tobyaw/.cache/rubocop_cache/05049447917d12ccd9963972b8d2f31cd20e5928/6d7a3b621ca1730e04accd938619e4bdab66cfb1/c47fd0571652f491f0955dba32cb5933e95d6a5f C Offenses: test.rb:4:4: C: [Correctable] Style/HashExcept: Use except(v.count) instead. {}.reject { |_k, v| v.count.eql? 1 } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 file inspected, 1 offense detected, 1 offense auto-correctable Finished in 0.19939299998804927 seconds
Sample code:
#!/usr/bin/env ruby # frozen_string_literal: true {}.reject { |_k, v| v.count.eql? 1 }
Rubocop config:
AllCops: TargetRubyVersion: 3.0 NewCops: enable
% rubocop -V 1.19.1 (using Parser 3.0.2.0, rubocop-ast 1.10.0, running on ruby 3.0.2 x86_64-darwin20)
The text was updated successfully, but these errors were encountered:
[Fix rubocop#10031] Fix a false positive for Style/HashExcept
Style/HashExcept
da9b99e
Fixes rubocop#10031. This PR fixes a false positive for `Style/HashExcept` when comparing with hash value.
[Fix #10031] Fix a false positive for Style/HashExcept
7b0358f
Fixes #10031. This PR fixes a false positive for `Style/HashExcept` when comparing with hash value.
Successfully merging a pull request may close this issue.
I have code:
and the Style/HashExcept rule changes this to invalid and non-equivalent code:
Expected behavior
The Style/HashExcept rule should not trigger.
Actual behavior
Steps to reproduce the problem
Sample code:
Rubocop config:
RuboCop version
The text was updated successfully, but these errors were encountered: