govuk_publishing_components icon indicating copy to clipboard operation
govuk_publishing_components copied to clipboard

Views using features deprecated in Ruby 2.7+ (and likely breaking in Ruby 3)

Open KludgeKML opened this issue 3 years ago • 2 comments

When running tests for the smart answers app, which includes this gem, we see deprecation messages like:

/var/lib/jenkins/bundles/ruby/2.7.0/gems/govuk_publishing_components-28.5.0/app/views/govuk_publishing_components/components/_input.html.erb:101: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call

These are 2.7 deprecations, and will become breaking changes in Ruby 3.0, and require changing (eg)

<% if button.info_text %>
  <%= tag.span button.info_text, button.info_text_options %>
<% end %>

..to..

<% if button.info_text %>
  <%= tag.span button.info_text, **button.info_text_options %>
<% end %>

(ie using a double splat to explicitly break the single argument into named arguments to the method)

This sort of call occurs quite frequently in the component views, so might need someone to build the gem against 2.7 and run through the tests with deprecation messages on.

KludgeKML avatar Feb 10 '22 16:02 KludgeKML

I've just run into this @KludgeKML – thanks for recording the issue for visibility!

alex-ju avatar Feb 10 '22 16:02 alex-ju

Related issue in govuk_app_config: https://github.com/alphagov/govuk_app_config/issues/222

KludgeKML avatar Feb 10 '22 16:02 KludgeKML

This has already been addressed.

maxgds avatar Oct 13 '22 07:10 maxgds