Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #7712. This PR fixes an incorrect autocorrect for `Style/OrAssignment` when using `elsif` branch. The following is a reproduction procedure. ```ruby % cat example.rb foo = if foo foo elsif bar else 'default' end ``` It is changed to the code with syntax error as follows. ```console % bundle exec rubocop -a --only Style/OrAssignment (snip) % cat example.rb foo ||= elsif bar else 'default' % ruby -c example.rb example.rb:1: syntax error, unexpected `elsif' foo ||= elsif ``` The or assignment operator replaced when using `elsif` branch is complicated. The PR will accept the above case without offense.
- Loading branch information
Showing
3 changed files
with
18 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters