-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #7616. This PR fixes an incorrect autocorrect for `Style/MultilineWhenThen` for when statement with then is an array or a hash. The following is a reproduction procedure. ```console % cat example.rb case condition when foo then { key: 'value' } end % ruby -c example.rb Syntax OK ``` It is changed to the code with syntax error as follows. ```console % bundle exec rubocop -a --only Style/MultilineWhenThen (snip) % cat example.rb case condition when foo { key: 'value' } end % ruby -c example.rb example.rb:3: syntax error, unexpected ':', expecting '}' key: 'value' example.rb:4: syntax error, unexpected '}', expecting end-of-input ``` The same is true when replacing a hash with an array. The PR will accept these cases without offense.
- Loading branch information
Showing
3 changed files
with
26 additions
and
1 deletion.
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