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 saw #10605 and the fix in #10606, so I got the latest RuboCop straight from GitHub and my use case still produced the wrong behavior.
No problem is reported, and autocorrect doesn't break code.
Offenses: app/controllers/shots_controller.rb:29:11: C: [Corrected] Style/RedundantCondition: Use double pipes || instead. @shot ? redirect_to(@shot) : redirect_to(:root)
RuboCop autocorrection changes the code above to:
@shot || redirect_to(:root)
which in turn breaks the code since in the happy path we don't have redirect anymore.
❯ bundle exec rubocop -V 1.29.0 (using Parser 3.1.2.0, rubocop-ast 1.17.0, running on ruby 3.1.2 x86_64-darwin21) - rubocop-performance 1.13.3 - rubocop-rails 2.14.2
in Gemfile.lock:
GIT remote: https://github.com/rubocop/rubocop.git revision: 3531610b1b3f39d4ea39c45271d74e2565cac2b7 specs: rubocop (1.29.0) parallel (~> 1.10) parser (>= 3.1.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) rubocop-ast (>= 1.17.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0)
The text was updated successfully, but these errors were encountered:
[Fix rubocop#10607] Fix autocorrect for Style/RedundantCondition wh…
Style/RedundantCondition
ea7f73f
…en there are parenthesized method calls in each branch
Merge pull request #10609 from nobuyo/fix-autocorrect-for-style-redun…
5912850
…dant-condition-with-parentheses [Fix #10607] Fix autocorrect for `Style/RedundantCondition` with parenthesized method call
Successfully merging a pull request may close this issue.
I saw #10605 and the fix in #10606, so I got the latest RuboCop straight from GitHub and my use case still produced the wrong behavior.
Expected behavior
No problem is reported, and autocorrect doesn't break code.
Actual behavior
RuboCop autocorrection changes the code above to:
which in turn breaks the code since in the happy path we don't have redirect anymore.
RuboCop version
in Gemfile.lock:
The text was updated successfully, but these errors were encountered: