ruby-http-client icon indicating copy to clipboard operation
ruby-http-client copied to clipboard

`warning: literal string will be frozen in the future` in ruby 3.4.0-preview2

Open tmimura39 opened this issue 1 year ago • 7 comments

Warning by https://bugs.ruby-lang.org/issues/20205

# bundle exec rake minitest
Run options: --seed 23847

# Running:

/ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
...../ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
./ruby-http-client/lib/ruby_http_client.rb:156: warning: literal string will be frozen in the future
./ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
.../ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
.../ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
../ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
.../ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
/ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
/ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
....../ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
.../ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
.../ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
.F./ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
./ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future

The choices are these

  • Use ''.dup or String.new('') or +''.
  • Magic comment frozen_string_literal: false like Shopify/httpclient.
  • Ignore warnings until Ruby v3.4 policy is finalized.
  • and other...

tmimura39 avatar Oct 15 '24 12:10 tmimura39

Hi @tmimura39 I made a PR that hopefully should resolve the issue

chaadow avatar Nov 17 '24 23:11 chaadow

Thanks. Yes, I agree. I think that will resolve this issue 😄

tmimura39 avatar Dec 17 '24 06:12 tmimura39

Any update on that? Ruby 3.4 is publicly available now.

qarol avatar Jan 10 '25 07:01 qarol

please could you look at my PR @pmcanseco thanks

chaadow avatar Feb 22 '25 11:02 chaadow

Is there any progress on this issue? We updated to Ruby 3.4 and we're seeing these warnings as well. The next version of Ruby isn't far off, and while it doesn't seem like the change to frozen strings will happen this year, it's still better to get ahead of the change.

https://bugs.ruby-lang.org/issues/20205#note-75

daniel-sabourin avatar Sep 12 '25 22:09 daniel-sabourin

Who is currently maintaining this repository? I’ll mention people who seem to be involved based on past commits.

@garethpaul @eshanholtz @thinkingserious

If you know who’s in charge, I’d appreciate it if you could let me know.

willnet avatar Sep 18 '25 07:09 willnet

Since there was no response, I went ahead and emailed the address listed at https://github.com/sendgrid/ruby-http-client/blob/4c9405c448dfec47ee0d37bfcafb10dab58da077/ruby_http_client.gemspec#L8

willnet avatar Oct 02 '25 07:10 willnet