Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR fixes the following error for `Style/IfInsideElse` when a deep nested multiline `if...then...elsif...else...end`: ```console $ cat example.rb if cond else if nested_one else if c if d else if e end end end end end ``` ```console $ bundle exec rubocop --only Style/IfInsideElse -a Inspecting 1 file An error occurred while Style/IfInsideElse cop was inspecting /Users/koic/src/github.com/koic/rubocop-issues/if_inside_else/example.rb:6:6. To see the complete backtrace run rubocop -d. C Offenses: example.rb:3:3: C: [Corrected] Style/IfInsideElse: Convert if nested inside else to elsif. if nested_one ^^ example.rb:5:5: C: [Corrected] Style/IfInsideElse: Convert if nested inside else to elsif. if c ^^ example.rb:6:9: C: [Corrected] Style/IfInsideElse: Convert if nested inside else to elsif. if e ^^ 1 file inspected, 3 offenses detected, 3 offenses corrected 1 error occurred: An error occurred while Style/IfInsideElse cop was inspecting /Users/koic/src/github.com/koic/rubocop-issues/if_inside_else/example.rb:6:6. Errors are usually caused by RuboCop bugs. Please, report your problems to RuboCop's issue tracker. https://github.com/rubocop/rubocop/issues Mention the following information in the issue report: 1.50.2 (using Parser 3.2.2.1, rubocop-ast 1.28.1, running on ruby 3.2.1) [x86_64-darwin19] ``` The autocorrection is repeated until all warnings are eliminated, so it is effectively compatible with the previous autocorrection.
- Loading branch information