Add compatibility with --enable-frozen-string-literal #305
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.
Since Ruby 2.7, Ruby can be run with --enable-frozen-string-literal to improve memory efficiency and avoid mistakes.
Ruby 3.4 is also now moving towards a world where string literals are frozen by default:
https://www.ruby-lang.org/en/news/2024/05/16/ruby-3-4-0-preview1-released/
This commit handles errors that arise when Phonelib is run with this feature enabled. It add the option to the CI configuration via an environment variable to ensure that regressions are not introduced.
In doing so, I needed to upgrade the simplecov gem to at least 0.15.0, because that’s the first version that is compatible with --enable-frozen-string-literal:
https://github.com/simplecov-ruby/simplecov/blob/main/CHANGELOG.old.md#0150-2017-08-14-changes
This upgrade was prevented by the codeclimate-test-reporter gem, which locks simplecov to <= 0.13.
However, I found that codeclimate-test-reporter is deprecated (https://github.com/codeclimate/ruby-test-reporter) and also that the uses of it in this codebase had already been commented out. Therefore I have removed it entirely, enabling the upgrade to simplecov.