forked from rubocop/rubocop
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes rubocop#7841. This PR fixes an error for `Style/TrailingCommaInBlockArgs` cop when lambda literal (`->`) has multiple arguments. It will not be checked in the case of lambda literal because lambda literal (`->`) never have a block arguments. ```console # Valid syntax % ruby -ce '-> (foo, bar) { do_something(foo, bar) }' Syntax OK # Syntax error % ruby -ce '-> { |foo| do_something }' -e:1: syntax error, unexpected '|' -> { |foo| do_something } ^ # Also syntax error % ruby -ce '-> (foo, bar,) { do_something(foo, bar) }' -e:1: syntax error, unexpected ')' -> (foo, bar,) { do_something(foo, bar) } ^ -e:1: syntax error, unexpected '}', expecting end-of-input r,) { do_something(foo, bar) } ^ ```
- Loading branch information
Showing
3 changed files
with
32 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
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