Disable frozen string literal comment checking
Solution 1
This one worked for me
Style/FrozenStringLiteralComment:
Enabled: false
Solution 2
You might want to add the following to your .rubocop.yml
:
Style/FrozenStringLiteralComment:
Enabled: false
Is it a bad idea to disable this cop? It depends. You probably want to revisit this before migrating to Ruby 3.0. But because Ruby 3.0 will not be released soon, there might be more important things to do in the meanwhile.
Solution 3
Adding rubocop.yml
file not worked for me. It should be .rubocop.yml
.
Create a .rubocop.yml
file in the root directory of the Rails app and add the following code to disable frozen_string_literal
check.
.rubocop.yml
Style/FrozenStringLiteralComment:
Enabled: false
Solution 4
Further to this, If you don't want any magic frozen_string_literal comments, you can use this:
Style/FrozenStringLiteralComment:
EnforcedStyle: never
![mpalencia](https://i.stack.imgur.com/IV49t.jpg?s=256&g=1)
mpalencia
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Updated on June 18, 2022Comments
-
mpalencia about 2 years
I'm newbie in Rails. I am using 'Rubocop' for checking standards, however I'm bothered with the way it checks the 'frozen string literal'. It keeps on saying on my files:
Missing frozen string literal comment.
Is there a way to disable the checking of this on rubocop? Or is it a bad idea to disable it?
I tried this on rubocop.yml but didn't work
frozen_string_literal: false
-
gonzaloriestra almost 5 yearsIt seems like Ruby 3.0 won't include frozen string literals by default, so it should be safe to disable it: bugs.ruby-lang.org/issues/11473#note-53