-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.6 warning: passing splat keyword arguments as a single Hash #32556
Merged
Conversation
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
r? @schneems (@rails-bot has picked a reviewer for you, use r? to override) |
utilum
force-pushed
the
splat
branch
6 times, most recently
from
April 15, 2018 08:08
690095b
to
86cafe7
Compare
Ruby 2.6.0 warns about this. ``` ruby -v ruby 2.6.0dev (2018-04-04 trunk 63085) [x86_64-linux] ``` Before, see: https://travis-ci.org/rails/rails/jobs/365740163#L1262-L1264 https://travis-ci.org/rails/rails/jobs/365944863#L2121-L2174
kamipo
reviewed
Apr 17, 2018
@@ -200,7 +200,7 @@ def open_connection | |||
end | |||
|
|||
def receive(connection, command:, identifiers:, channel: "ActionCable::StreamTests::ChatChannel") | |||
identifier = JSON.generate(channel: channel, **identifiers) | |||
identifier = JSON.generate(identifiers.merge(channel: channel)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changed merging order, but I confirmed that changing order in this helper method has no effect.
8 tasks
koic
added a commit
to koic/rubocop
that referenced
this pull request
May 10, 2018
## Summary This cop emulates the following Ruby warnings in Ruby 2.6. ruby/ruby@a23eca2 ```console % ruby -we "def m(a) end; h = {foo: 1}; m(**h)" -e:1: warning: passing splat keyword arguments as a single Hash to `m' ``` This cop does not have autocorrect because uses of splat keyword arguments duplicates the argument hash instance. So, it is not necessarily compatible code. ### Use splat keyword arguments (`foo(**h)`) ```console % ruby -vwe "def m(a) p a.object_id; end; h = {k: :v}; p h.object_id; m(**h)" ruby 2.6.0dev (2018-05-08 trunk 63359) [x86_64-darwin17] 70248917856620 -e:1: warning: passing splat keyword arguments as a single Hash to `m' 70248917856460 ``` ### Use non-splat keyword arguments (`foo(h)`) ```console % ruby -vwe "def m(a) p a.object_id; end; h = {k: :v}; p h.object_id; m(h)" ruby 2.6.0dev (2018-05-08 trunk 63359) [x86_64-darwin17] 70211441327220 70211441327220 ``` ## Other Information While this warning is experimental, however work on rails/rails has begun. - rails/rails#32447 - rails/rails#32556 - rails/rails#32612
bbatsov
pushed a commit
to rubocop/rubocop
that referenced
this pull request
May 14, 2018
## Summary This cop emulates the following Ruby warnings in Ruby 2.6. ruby/ruby@a23eca2 ```console % ruby -we "def m(a) end; h = {foo: 1}; m(**h)" -e:1: warning: passing splat keyword arguments as a single Hash to `m' ``` This cop does not have autocorrect because uses of splat keyword arguments duplicates the argument hash instance. So, it is not necessarily compatible code. ### Use splat keyword arguments (`foo(**h)`) ```console % ruby -vwe "def m(a) p a.object_id; end; h = {k: :v}; p h.object_id; m(**h)" ruby 2.6.0dev (2018-05-08 trunk 63359) [x86_64-darwin17] 70248917856620 -e:1: warning: passing splat keyword arguments as a single Hash to `m' 70248917856460 ``` ### Use non-splat keyword arguments (`foo(h)`) ```console % ruby -vwe "def m(a) p a.object_id; end; h = {k: :v}; p h.object_id; m(h)" ruby 2.6.0dev (2018-05-08 trunk 63359) [x86_64-darwin17] 70211441327220 70211441327220 ``` ## Other Information While this warning is experimental, however work on rails/rails has begun. - rails/rails#32447 - rails/rails#32556 - rails/rails#32612
yahonda
pushed a commit
to yahonda/rails
that referenced
this pull request
Dec 24, 2018
2.6 warning: passing splat keyword arguments as a single Hash
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ruby 2.6.0 warns about this.
Before, see:
https://travis-ci.org/rails/rails/jobs/365740163#L1262-L1264
https://travis-ci.org/rails/rails/jobs/365944863#L2121-L2174