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

Add compatibility with --enable-frozen-string-literal #305

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jonleighton
Copy link

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.

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.
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.

None yet

1 participant