Closed MatzFan closed 5 months ago
I don't believe its time for this quite yet. While I'd love to finally get rid of these comments there are subtle differences during the migration time until Ruby 4.0:
frozen? == true
but can still be modified (subject to change, see https://bugs.ruby-lang.org/issues/20205#note-45)It seems better for interested users to manually set EnforcedStyle: never
until they are truly frozen.
The behavior is still unstable with the introduction of the new concept of "chilled string". It might be better to wait until the specification stabilize.
I shall chill along with my strings :-)
FYI, The following is an article worth reading to understand the current state of frozen string literal. https://gist.github.com/fxn/bf4eed2505c76f4fca03ab48c43adc72#can-i-delete-the-magic-comments-in-ruby-34
Ruby 3.4.0preview1 was released on May 16 and string literals are (finally) frozen by default. See release notes.
Expected behavior
With Ruby 3.4.0preview1 In a file without the string literal comment I would expect no offense. In a file with the string literal comment I would expect an offense stating that the string literal comment is unnecessary
Note: As deprecation warnings are not emitted by default the cop comment may want to suggest using
Warning[:deprecated] = true
or enabling the flag with-W:deprecated
Actual behavior
"Style/FrozenStringLiteralComment: Missing frozen string literal comment" cop is triggered
Steps to reproduce the problem
With Ruby 3.4.0preview1:
RuboCop version