Skip to content

Add Frozen String Literal Magic Comment to tests - #781

Merged
nesquena merged 1 commit into
masterfrom
chore/fzs-non-production
Dec 28, 2025
Merged

nesquena merged 1 commit into
masterfrom
chore/fzs-non-production

Conversation

@tagliala

@tagliala tagliala commented Dec 28, 2025

Copy link
Copy Markdown
Collaborator

Changes have been applied exclusively to non-production code. The updates were
performed automatically using:

rubocop --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment,Style/RedundantFreeze -Am test/**/*.rb

An additional modification was required to RiotTestHelpers.char_split, where
the string is now duplicated before calling String#force_encoding to prevent
errors related to modifying frozen strings.

The CI received t:

  • Update the checkout action to v6
  • Enable frozen string flags in RUBYOPT when testing against Ruby >= 3.0

Ref:

@tagliala
tagliala force-pushed the chore/fzs-non-production branch from f1ead73 to a69246a Compare December 28, 2025 18:13
@nesquena

Copy link
Copy Markdown
Owner

LGTM, thanks!

@tagliala
tagliala force-pushed the chore/fzs-non-production branch from a69246a to a190f58 Compare December 28, 2025 18:16
@tagliala
tagliala marked this pull request as draft December 28, 2025 18:20
@tagliala

Copy link
Copy Markdown
Collaborator Author

Those environment variables can be conditionally enabled I guess, I'll do some other changes. Reverted to draft

@tagliala
tagliala force-pushed the chore/fzs-non-production branch 2 times, most recently from cc965a7 to dd9d2ce Compare December 28, 2025 18:41
Changes have been applied exclusively to non-production code. The updates were
performed automatically using:

```
rubocop --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment,Style/RedundantFreeze -Am test/**/*.rb
```

An additional modification was required to `RiotTestHelpers.char_split`, where
the string is now duplicated before calling `String#force_encoding` to prevent
errors related to modifying frozen strings.

The CI received t:
- Update the checkout action to v6
- Enable frozen string flags in RUBYOPT when testing against Ruby >= 3.0

Ref:
- #780
- https://gist.github.com/fxn/bf4eed2505c76f4fca03ab48c43adc72
@tagliala
tagliala force-pushed the chore/fzs-non-production branch from dd9d2ce to 0e31499 Compare December 28, 2025 18:41
@tagliala
tagliala marked this pull request as ready for review December 28, 2025 18:46
@tagliala

Copy link
Copy Markdown
Collaborator Author

@nesquena ready for review, minimal change to the workflow.

Apparently there is no ">=" for strings in CI. The change looks simple enough.

I've checked that environment is being considered by commenting the if in a now removed commit, as seen in this expected failure: https://github.com/nesquena/rabl/actions/runs/20557948738/job/59044709489#step:5:9

@nesquena

Copy link
Copy Markdown
Owner

Nice fix, looks good to me to merge!

@nesquena
nesquena merged commit 2a19185 into master Dec 28, 2025
16 checks passed
@nesquena
nesquena deleted the chore/fzs-non-production branch December 28, 2025 18:49
@tagliala

Copy link
Copy Markdown
Collaborator Author

Now it is production code turn, but I'll give a try hopefully tomorrow

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