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

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

Open
tmimura39 opened this issue Oct 15, 2024 · 1 comment

Comments

@tmimura39
Copy link

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

# rake
/usr/local/bundle/gems/activesupport-6.1.3/lib/active_support/core_ext/class/subclasses.rb:30: warning: method redefined; discarding old subclasses
-- create_table("legs", {force: true})
   -> 0.0014s
-- create_table("chairs", {force: true})
   -> 0.0002s

# Running tests with run options --seed 53168:

../prosopite/lib/prosopite.rb:220: warning: literal string will be frozen in the future
../prosopite/lib/prosopite.rb:220: warning: literal string will be frozen in the future
...../prosopite/lib/prosopite.rb:220: warning: literal string will be frozen in the future
./prosopite/lib/prosopite.rb:220: warning: literal string will be frozen in the future
./prosopite/lib/prosopite.rb:220: warning: literal string will be frozen in the future
../prosopite/lib/prosopite.rb:220: warning: literal string will be frozen in the future
./prosopite/lib/prosopite.rb:220: warning: literal string will be frozen in the future
../prosopite/lib/prosopite.rb:220: warning: literal string will be frozen in the future
..../prosopite/lib/prosopite.rb:220: warning: literal string will be frozen in the future
./prosopite/lib/prosopite.rb:220: warning: literal string will be frozen in the future
../prosopite/lib/prosopite.rb:220: warning: literal string will be frozen in the future
./prosopite/lib/prosopite.rb:220: warning: literal string will be frozen in the future
../prosopite/lib/prosopite.rb:220: warning: literal string will be frozen in the future
............................

Finished tests in 0.578294s, 93.3781 tests/s, 143.5256 assertions/s.


54 tests, 83 assertions, 0 failures, 0 errors, 0 skips

The choices are these

  • Use ''.dup or String.new('') or +''.
diff --git a/lib/prosopite.rb b/lib/prosopite.rb
index 5dee267..16f3a13 100644
--- a/lib/prosopite.rb
+++ b/lib/prosopite.rb
@@ -214,7 +214,7 @@ def send_notifications
       @prosopite_logger ||= false
       @raise ||= false

-      notifications_str = ''
+      notifications_str = +''

       tc[:prosopite_notifications].each do |queries, kaller|
         notifications_str << "N+1 queries detected:\n"
  • Magic comment frozen_string_literal: false like Shopify/httpclient.
  • Ignore warnings until Ruby v3.4 policy is finalized.
  • and other...
@Uaitt
Copy link

Uaitt commented Dec 27, 2024

Hello, any update about this?

Ruby 3.4 has been released, which means that all Rails apps that use Prosopite will see those warnings 😓.

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

No branches or pull requests

2 participants