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

Converter code produces "literal string will be frozen in the future" warnings #14

Open
StalemateInc opened this issue Dec 28, 2024 · 0 comments · May be fixed by #15
Open

Converter code produces "literal string will be frozen in the future" warnings #14

StalemateInc opened this issue Dec 28, 2024 · 0 comments · May be fixed by #15

Comments

@StalemateInc
Copy link

Greetings 👋

Running this gem produces the warnings like this one:

html2markdown/lib/html2markdown/converter.rb:54: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information)

With this change in Ruby 3.4.1 all string literals behave like they are frozen (which will likely happen by default in next Ruby iterations). The solution is to either disable strings freezing on per-file basis or adjust the code to no longer produce the frozen strings where they are modified.

Steps:
To reproduce the warnings:

> bundle exec rspec --warnings

To see the failures from upcoming behaviour:

> RUBYOPT='--enable=frozen-string-literal' bundle exec rspec

Expected result: All tests pass.
Actual result: All tests fail with an errors like FrozenError: can't modify frozen String: "".

Ruby version:

> ruby -v
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [x86_64-darwin22]
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 a pull request may close this issue.

1 participant