Skip to content
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

Handle the other two part warning from Ruby 2.7 #46

Merged
merged 2 commits into from
Apr 28, 2020

Conversation

casperisfine
Copy link
Contributor

Followup to: #45

There is a second type of multipart warning I missed:

def foo(hash, a: 1, b: 1)
  ...
end

foo(bar: 42)

In this case Ruby 2.7 complains because it's ambiguous wether you expect to pass the first parameter as a hash, or if you expected to pass keyword args.

Ruby expects you to call the method with explicit brackets:

foo({ bar: 42 })

Or better avoid this kind of method signatures.

Copy link
Member

@etiennebarrie etiennebarrie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to ignore the suggestion.

@@ -6,13 +6,20 @@ module Warning

@buffer = nil

# Ruby 2.7 has a warning for improper use of keyword arguments that is sent as two parts
# Ruby 2.7 has two warning for improper use of keyword arguments that is sent as two parts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Ruby 2.7 has two warning for improper use of keyword arguments that is sent as two parts
# Ruby 2.7 has two warnings for improper use of keyword arguments that are sent in two parts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thanks.

@casperisfine casperisfine force-pushed the handle-other-multipart-warning branch from 3d96e40 to 34d614a Compare April 28, 2020 14:32
@casperisfine casperisfine merged commit cdd8ee4 into master Apr 28, 2020
@shopify-shipit shopify-shipit bot temporarily deployed to rubygems March 16, 2022 22:06 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants