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

Upgrade to ruby 2.7.1 #1395

Merged
merged 3 commits into from Sep 25, 2020
Merged

Upgrade to ruby 2.7.1 #1395

merged 3 commits into from Sep 25, 2020

Conversation

cdccollins
Copy link
Contributor

@cdccollins cdccollins commented Sep 8, 2020

These are the changes necessary for the app to run on Ruby 2.7.1.

I have left the version of Ruby the same, since there is a script that can be run after all the apps have been updated to update the version all at once.

Still some warnings coming from Rspec-mocks, the fix has not been merged yet

.ruby-version Outdated Show resolved Hide resolved
@cdccollins cdccollins force-pushed the upgrade-to-ruby-2.7 branch 7 times, most recently from 7a0e239 to 8c94819 Compare September 10, 2020 08:16
@kevindew
Copy link
Member

I think it'd be beneficial to include the .ruby-version change as part of this for a few reasons: allows using syntax for 2.7, makes it easier to double check in review the quantity of warnings we'll have to deal with, and one less thing to review/deploy when ready.

For the places where we're doing argument forwarding it'd be good if we could use the ... operator in 2.7 (sidenote, I'm not sure that operator has a name? I call it the ellipsis one). For example we could change:

def self.call(*args, **kwargs)
new(*args, **kwargs).call
end

to

  def self.call(...)
    new(...).call
  end

which would mean we could avoid adding the double splats in: app/services/immediate_email_generation_service.rb, app/services/matched_content_change_generation_service.rb and a few more.

I notice we still get about 5 warnings still about kwargs in 2.7, is that something we're experiencing in most repos? I see CSV and RSpec are the culprits here, do we know if they have upgrade plans?

@pixeltrix
Copy link
Contributor

For the places where we're doing argument forwarding it'd be good if we could use the ... operator in 2.7 (sidenote, I'm not sure that operator has a name? I call it the ellipsis one). For example we could change:

Operator forwarding was only added in Ruby 2.7 so we'd need to deploy either both the Ruby upgrade and the app at the same time or deploy the Ruby upgrade first and then the app upgrade to fix it with Ruby 2.7. I'd be nervous about using a version specific feature during the deployment process and maybe that's something that should be addressed via a Rubocop rule in a later deploy?

I notice we still get about 5 warnings still about kwargs in 2.7, is that something we're experiencing in most repos? I see CSV and RSpec are the culprits here, do we know if they have upgrade plans?

Looks like the CSV error is because the app is using the CSV() singleton method which is a pretty dated pattern - we can probably re-write the code to avoid the method. The [RSpec fix] is yet to be merged.

@pixeltrix
Copy link
Contributor

pixeltrix commented Sep 10, 2020

@kevindew seems like you suggested to use CSV() in this comment - any preference whether we should replace it with CSV.instance or CSV.new ?

@kevindew
Copy link
Member

@kevindew seems like you suggested to use CSV() in this comment - any preference whether we should replace it with CSV.instance or CSV.new ?

Very sorry for the long delay, I started writing a reply but must have never finished.

I just suggested using CSV directly for consistency with our existing approach - I don't know enough about the choice to have a preference, though .new sounds more idiomatic. Happy with whatever feels most appropriate.

Warning: Passing the keyword argument as the last hash parameter is deprecated

See https://blog.bigbinary.com/2020/04/14/ruby-2-7-deprecates-conversion-of-keyword-arguments.html

There are some warnings that come from gems outside hte project, e.g. rspec-mocks
@cdccollins cdccollins merged commit d6b26bd into master Sep 25, 2020
@cdccollins cdccollins deleted the upgrade-to-ruby-2.7 branch September 25, 2020 10:25
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.

None yet

5 participants