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

Handle frozen string deprecations from ruby 3.4.1 #545

Merged

Conversation

jsugarman
Copy link
Collaborator

@jsugarman jsugarman commented Jan 9, 2025

Handle frozen string deprecations from ruby 3.4.1

receiver.concat will mutate the receiver which is deprecated in 3.4 and
will error, by default, in ruby 3.5. target.prepend('#') will not mutate the
prefix string, thereby avoiding the problem.

Identified on CI for consuming app

This adds the frozen_string_literal: true directive explicitly to cause the failure and then fixes.

Copy link

netlify bot commented Jan 9, 2025

👷 Deploy request for govuk-form-builder pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit a6ca88b

@jsugarman jsugarman force-pushed the jsugarman/handle-frozen-string-deprecations branch 2 times, most recently from 427314d to 14d039d Compare January 9, 2025 14:25
@jsugarman jsugarman requested a review from peteryates January 9, 2025 14:29
@jsugarman
Copy link
Collaborator Author

Hi @peteryates,

Not sure if this is too early but, aside from the code coverage issue, it looks like this small change works and should remove the deprecation warnings we are seeing on our CI against ruby 3.4.1.

@jsugarman jsugarman marked this pull request as ready for review January 9, 2025 15:16
@peteryates
Copy link
Member

Looks great, thanks @jsugarman! Left a comment but other than that happy to accept.

OpenStruct has been deprecated in 3.4 and will been removed
from ruby stdlib in 3.5.

see [github issue](dependabot/dependabot-core#11163)
Add the frozen_string_literal to force failures then fix.

`receiver.concat` will mutate the receiver which is deprecated in 3.4 and
will error, by default, in ruby 3.5. `target.prepend('#')` will not mutate the
prefix string.
@jsugarman jsugarman force-pushed the jsugarman/handle-frozen-string-deprecations branch from 14d039d to 1b6f202 Compare January 10, 2025 09:32
Copy link
Member

@peteryates peteryates left a comment

Choose a reason for hiding this comment

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

Looks great!

Can we just update the supported versions in the README and the guide's supported versions page and we can get this merged 🙂

Noticed the badge for ruby was 3.2.6 so have amended
inline with current latest patch level for 3.2.
@jsugarman
Copy link
Collaborator Author

Can we just update the supported versions in the README and the guide's supported versions page and we can get this merged 🙂

I think that covers the supported version changes🤞. I also bumped ruby 3.2 to latest patch when i noticed the ruby badge already mentioned 3.2.6.

Copy link
Member

@peteryates peteryates left a comment

Choose a reason for hiding this comment

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

Amazing, thank you 🚀

@jsugarman jsugarman merged commit deb8089 into x-govuk:main Jan 10, 2025
12 of 13 checks passed
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.

2 participants