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

Style/MutableConstant false positive with frozen_string_literal: true and line continuation #10134

Closed
JacobEvelyn opened this issue Sep 28, 2021 · 0 comments · Fixed by #10139
Assignees
Labels

Comments

@JacobEvelyn
Copy link
Contributor

When # frozen_string_literal: true is set, a constant string that includes a line continuation (\) is incorrectly flagged by the Style/MutableConstant cop, even though the constant is indeed frozen.


Expected behavior

RuboCop should not flag this as a Style/MutableConstant violation.

Actual behavior

RuboCop wants a .freeze at the end of the string literal to appease the Style/MutableConstant cop.

Steps to reproduce the problem

# frozen_string_literal: true

C = 'this is a string '\
    'wrapped onto another line'

RuboCop version

$ bundle exec rubocop -V
1.21.0 (using Parser 3.0.2.0, rubocop-ast 1.11.0, running on ruby 3.0.2 x86_64-darwin20)
  - rubocop-performance 1.11.5
  - rubocop-rails 2.12.2
  - rubocop-rspec 2.4.0
@dvandersluis dvandersluis self-assigned this Sep 28, 2021
dvandersluis added a commit to dvandersluis/rubocop that referenced this issue Sep 29, 2021
…ltiline uninterpolated strings as unfrozen in ruby 3.0.
koic added a commit that referenced this issue Sep 29, 2021
[Fix #10134] Update `Style/MutableConstant` to not consider multiline uninterpolated strings as unfrozen in ruby 3.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants