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
Attempting auto-fix (rubocop -a) on a file with case statement using in (pattern matching) and an empty else clause causes an infinite loop.
rubocop -a
case
in
else
There shouldn't be an infinite loop. The empty else clause should be allowed.
The two following offenses are detected, and the auto-correction for one contradicts the other:
Offenses: test.rb:5:5: C: [Corrected] Layout/IndentationWidth: Use 2 (not 0) spaces for indentation. else test.rb:5:7: C: [Corrected] Layout/ElseAlignment: Align else with in. else ^^^^ 0 files inspected, 2 offenses detected, 2 offenses corrected Infinite loop detected in <path>/test.rb and caused by Layout/IndentationWidth -> Layout/ElseAlignment
x = 1 case x in [:x, _] then puts ":x" else end
rubocop -a test.rb
$ rubocop -V 1.35.0 (using Parser 3.1.2.1, rubocop-ast 1.21.0, running on ruby 3.1.2 arm64-darwin21) - rubocop-performance 1.14.3```
The text was updated successfully, but these errors were encountered:
[Fix rubocop#10963] Fix a false positive for Layout/IndentationWidth
Layout/IndentationWidth
10cf610
Fixes rubocop#10963. This PR fixes a false positive for `Layout/IndentationWidth` when using aligned empty `else` in pattern matching.
Merge pull request #10964 from koic/fix_a_false_positive_for_layout_i…
2daf9f1
…ndentation_width [Fix #10963] Fix a false positive for `Layout/IndentationWidth`
Successfully merging a pull request may close this issue.
Attempting auto-fix (
rubocop -a
) on a file withcase
statement usingin
(pattern matching) and an emptyelse
clause causes an infinite loop.Expected behavior
There shouldn't be an infinite loop. The empty
else
clause should be allowed.Actual behavior
The two following offenses are detected, and the auto-correction for one contradicts the other:
Steps to reproduce the problem
rubocop -a test.rb
.RuboCop version
The text was updated successfully, but these errors were encountered: