Ruby 3.4.10 address frozen string warning - #1
Open
tsoto111 wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Ruby 3.4.10 has started adding a new warning polluting our application logs.
This is specifically being raised by
mname.chomp!('=')vialib/persistent_open_struct.rbas it is mutating the original string saved tomname. This will raise an error in the future whenmnamevariable string is frozen.Solution
Logic was refactored to not modify the original variable of
mnamein the conditional statement. Instead, we will perform a check ofmname.end_with?('=').Then, in the original usage of the modified variable we will now call
chompwithout the!to return adupstring instead of the original modified string. This refactor addresses the warnings of strings being frozen in future versions of ruby.Additional Cleanup
gemspecwhich allows everyone to use the version of bundler installed on their machine.assert_equalto checknil. To address this warning usage ofassert_nilwas added instead.Tests after updates