New 2.7/3.0 keyword argument pain point

Hi,

I’m going to speak from the point of view of a developer who is in charge of moving our rails monolith to ruby 2.7.

What I missed in the first place was a real strategy. Over 50 000 warnings generated by our CI, thousands from gems. I didn’t know where to start. So I waited, to see if a strategy emerges, or if the gem maintainers can quickly fix their warnings.

Then thanks to the twitter thread of Eileen Uchitelle and the contribution of Rafael França and Kevin Deisz (here, and here), I found something that could work in our case:

  1. Fix the errors related to this change Double splat with an empty hash ( **{} ) passes no arguments – about ten tests out of 15,000. Instead of a ActiveRecord::Relation we had a ActiveRecord::QueryMethods::WhereChain.

  2. Ignore deprecation warnings: warning.rb · GitHub. Thanks to this, I avoid flooding our log in production and in development.

  3. Use DeprecationToolkit from Shopify – Thanks ! – to list existing warnings in our codebase and avoid adding new ones. Thanks to this configuration, I ask him to take into account the warnings coming only from our codebase and not from the gems: deprecation_toolkit.rb · GitHub

  4. Fix them all.

With this approach, we will be able to merge ruby 2.7 quickly, then in a second step correct the warnings from our codebase in the coming weeks. This makes the transition much less painful on our side.

In conclusion, from my opinion:

  • New keywords argument are better than the old ones
  • What I needed was not more time, but a clear strategy to make the transition right

I hope that helps. :slight_smile:

20 Likes