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
Given the following code:
{foo: 1, bar: 2, baz: 3}.reject { |k, _v| k.in?(%I[bar baz]) }
Style/HashExcept does not trigger an offense, as currently it only support equality checks
It should suggest:
{foo: 1, bar: 2, baz: 3}.except(:bar, :baz)
Here are some other usages that could be detected:
{foo: 1, bar: 2, baz: 3}.reject { |k, _v| k.in?(SOME_CONSTANT) } {foo: 1, bar: 2, baz: 3}.reject { |k, _v| k.in?(some_var) } {foo: 1, bar: 2, baz: 3}.reject { |k, _v| %I[bar baz].include?(k) } {foo: 1, bar: 2, baz: 3}.select { |k, _v| %I[bar baz].exclude?(k) }
The text was updated successfully, but these errors were encountered:
Style/HashExcept
[Fix rubocop#10698] Enhance Style/HashExcept to support array inclusi…
8a5f755
…on checks
[Fix #10698] Enhance Style/HashExcept to support array inclusion checks
52c34a4
Successfully merging a pull request may close this issue.
Is your feature request related to a problem? Please describe.
Given the following code:
Style/HashExcept does not trigger an offense, as currently it only support equality checks
Describe the solution you'd like
It should suggest:
Here are some other usages that could be detected:
The text was updated successfully, but these errors were encountered: