-
-
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.
Fix an incorrect auto-correct for
Style/RedundantReturn
Fixes standardrb/standard#277. This PR fixes the following false positive for `Style/RedundantReturn` when using `return` with splat argument. ```console % cat example.rb class MyClass def something data = [1, 2, 3] return *data end end ``` ## Before Auto-corrected to invalid code. ```console % rubocop --only Style/RedundantReturn -a (snip) % cat example.rb class MyClass def something data = [1, 2, 3] *data end end % ruby -c example.rb example.rb:4: syntax error, unexpected '\n', expecting '=' ``` ## After Auto-corrected to valid code. ```console % rubocop --only Style/RedundantReturn -a (snip) % cat example.rb class MyClass def something data = [1, 2, 3] data end end % ruby -c example.rb Syntax OK ```
- Loading branch information
Showing
3 changed files
with
22 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* [#9631](https://github.com/rubocop/rubocop/issues/9631): Fix an incorrect auto-correct for `Style/RedundantReturn` when using `return` with splat argument. ([@koic][]) |
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