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
This code
class Pippo def foo result = if x X.find(x) else Y.find(y) end result.to_s end end
generates this warning:
app/pippo.rb:4:7: C: [Correctable] Style/RedundantCondition: Use double pipes || instead. if x ...
If I run rubocop -a it gets autofixed with:
rubocop -a
class Pippo def foo result = X.find(x || y) result.to_s end end
but the behavior now it's changed.
I think the cop should not raise a warning, because it's not a redundant condition 🤔
$ bundle exec rubocop -V ↳ $ bundle exec rubocop -V 1.29.1 (using Parser 3.1.2.0, rubocop-ast 1.17.0, running on ruby 2.7.6 x86_64-darwin21) - rubocop-performance 1.13.3 - rubocop-rails 2.14.2 - rubocop-rake 0.6.0 - rubocop-rspec 2.10.0
The text was updated successfully, but these errors were encountered:
Style/RedundantCondition
[Fix rubocop#10636] Fix false positive in Style/RedundantCondition …
ae8c285
…when the branches call the same method on different receivers.
Merge pull request #10637 from dvandersluis/issue/10636
00e7ac7
[Fix #10636] Fix false positive in `Style/RedundantCondition` when the branches call the same method on different receivers
thank you! <3
Sorry, something went wrong.
dvandersluis
Successfully merging a pull request may close this issue.
This code
generates this warning:
If I run
rubocop -a
it gets autofixed with:but the behavior now it's changed.
Expected behavior
I think the cop should not raise a warning, because it's not a redundant condition 🤔
RuboCop version
The text was updated successfully, but these errors were encountered: