barby icon indicating copy to clipboard operation
barby copied to clipboard

Fix 'warning: literal string will be frozen in the future' introduced by ruby 3.4

Open r-reload opened this issue 7 months ago • 2 comments

Ruby 3.4 #20205 feature makes the barby gem output warnings when used, such as:

/path/to/barby/lib/barby/barcode/qr_code.rb:56: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information)
/path/to/barby/lib/barby/barcode/qr_code.rb:56: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information)

This PR is an attempt to fix the problem by:

  • using .freeze on constants
  • rewriting some inject calls
  • and using pragma frozen_string_literal: false elsewhere

Note: I ran the test suite with ruby 3.4, and remove all warnings of this type. This PR does NOT tackle other warnings introduced by Ruby 3.4

r-reload avatar May 22 '25 17:05 r-reload

Hi @toretore 👋🏻 Any chance you could please review and release this change? This includes the single line change from #122 so that one can be closed once this is merged.

javierjulio avatar Jul 29 '25 01:07 javierjulio

hi @toretore, we would also very much like this fixed and released :) +1 on the request from me.

Is there anything I can assist you with to get this done? Happy to spend a bit of my time if wanted.

dennispaagman avatar Sep 26 '25 10:09 dennispaagman