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

[supply][Ruby 3] fix Ruby 3 keyword args issues #18703

Merged
merged 1 commit into from
May 18, 2021

Conversation

ainame
Copy link
Contributor

@ainame ainame commented May 17, 2021

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.

Motivation and Context

#18698

Description

Due to the lack of unit tests, we missed some Ruby 3 keyword args issues. I fixed another issue in supply/lib/supply/uploader.rb.
I checked with git grep "Google::Apis" and git grep "AndroidPublisher::" but the rest looks okay.

Testing Steps

@google-cla google-cla bot added the cla: yes label May 17, 2021
@ainame ainame requested a review from joshdholtz May 17, 2021 22:28
@@ -279,13 +279,13 @@ def latest_version(track)
def update_listing_for_language(language: nil, title: nil, short_description: nil, full_description: nil, video: nil)
ensure_active_edit!

listing = AndroidPublisher::Listing.new(**{
Copy link
Contributor Author

@ainame ainame May 17, 2021

Choose a reason for hiding this comment

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

Since other places already use keyword-ish style arguments, I made this consistent with others. ** would make sense where Hash object is given from somewhere else whereas this is just a hash literal that we can just omit {}.

[1] pry(main)> def hello(**args)
[1] pry(main)*   p args
[1] pry(main)* end
=> :hello
[2] pry(main)> hello(a: 1, b: 2)
{:a=>1, :b=>2}
=> {:a=>1, :b=>2}
[3] pry(main)> hello(**{a: 1, b: 2})
{:a=>1, :b=>2}
=> {:a=>1, :b=>2}
[4] pry(main)> hello({a: 1, b: 2})
ArgumentError: wrong number of arguments (given 1, expected 0)
from (pry):1:in `hello'

Both result in the same

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -233,10 +233,10 @@ def upload_changelog(language, version_code)
end
end

AndroidPublisher::LocalizedText.new({
AndroidPublisher::LocalizedText.new(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

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

This looks good to me!

@joshdholtz joshdholtz changed the title [Ruby 3] Fix Ruby 3 keyword args issues [supply][Ruby 3] fix Ruby 3 keyword args issues May 18, 2021
@joshdholtz joshdholtz merged commit 3e35e72 into master May 18, 2021
@joshdholtz joshdholtz deleted the ai/fix-google-client-api branch May 18, 2021 00:47
Copy link

@fastlane-bot fastlane-bot left a comment

Choose a reason for hiding this comment

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

Congratulations! 🎉 This was released as part of fastlane 2.183.2 🚀

@fastlane fastlane locked and limited conversation to collaborators Jul 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants