phonelib icon indicating copy to clipboard operation
phonelib copied to clipboard

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

Open jonleighton opened this issue 1 year ago • 2 comments

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.

jonleighton avatar May 27 '24 04:05 jonleighton

👋 Hi @jonleighton! We were hoping to see this work as well! Are you still hoping to push this forward?

@daddyz what do you think of these changes? Anything we can do to help add this functionality? 😄

radville avatar Aug 14 '24 14:08 radville

Yes, I'd still be keen to get this merged.

jonleighton avatar Aug 14 '24 23:08 jonleighton