-
Notifications
You must be signed in to change notification settings - Fork 46
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
Reports strings as mutable objects assigned to constants issue #50
Comments
Incidentally, this was also noticed directly in Rubocop: rubocop/rubocop#2630 |
@nielsm That check is correct in referring to strings as well, depending on the ruby version. Before Ruby 2.3, strings were mutable (https://wyeworks.com/blog/2015/12/1/immutable-strings-in-ruby-2-dot-3). Looks like rubocop fixed this in 0.37.2, which we are using. Have you tried running |
Yes, just updated, which is when I started getting the errors, but I'm running Ruby < 2.3 |
Hi @nielsm, I think this is just a case of RuboCop's help description not being exhaustive: strings do qualify as mutable objects for these cases. rubocop/rubocop#2630 is specifically about supporting the new auto-frozen strings on Ruby 2.3, so it doesn't sound like that applies in your case. The previous version of rubocop we were using also reported I'm going to go ahead & close this, but let me know if you have further questions. |
Given the following constant:
SOMETHING = 'something'
Will generate this error:
Freeze mutable objects assigned to constants.
The help description says this should only apply to array or hashes. Is it being too literal in considering a string an Array? This only began with the 0.20 release of the CLI
The text was updated successfully, but these errors were encountered: