-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[Ruby 3.0] Fix Ruby 2.7's deprecation warnings #18021
Conversation
f9d10f2
to
b210953
Compare
4075c44
to
5e3144b
Compare
Merged the main branch into this and no new warning is there. |
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 looks good to me! LGTM 🥳
This branch has the latest change in the main branch and no new warning. It's good to merge now. |
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.
Congratulations! 🎉 This was released as part of fastlane 2.178.0 🚀
Checklist
bundle exec rspec
from the root directory to see all new and existing tests passbundle exec rubocop -a
to ensure the code style is validMotivation and Context
As per plan #17931, I've been working on Ruby 3.0 migration in fastlane project. Prior to this PR, I have enabled CI testing for Ruby 2.7 #17861. We can now run unit testing in Ruby 2.7 in order to see if there are deprecation warnings by leveraging the new option "-W:deprecated" in Ruby 2.7.2.
There is a minor breaking change in Ruby 3.0 which is called "Separation of positional and keyword arguments". In short, the below code won't run on Ruby 3.0. Previously you could pass a Hash object as keyword arguments to a method, but now you need to either use
**
to turn Hash into keywords arguments or simply use keywords to pass parameters. This is the most common case we need to fix.See details below.
https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
Thanks to the warnings, I could fix them as far as I got. There might be more within this project potentially but it's impossible to review every single line of code. So I expect the community to report something not working on Ruby 3.0 if they find once the whole migration is done in future🙇
Note that this PR mostly covers the codebase within this project. There are also the same warnings from dependencies. I will work on it in another PR.
Description
Other than adding
**
or giving parameters to keyword arguments, I did the followings.FastlaneCore::Project
This is the list I used as a reference of where to fix. As I mentioned, I didn't try to fix issues in
slack-notifier
andrspec-mocks
in this list.https://gist.github.com/ainame/d7f1c4d2fb07f139d3a0f064d4cbda75
Testing Steps
CI passed unit tests on all the environments. I will give it a try on my project briefly, too🙂