Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable frozen string literal comment checking

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 
like image 229
mpalencia Avatar asked Jul 12 '16 09:07

mpalencia


People also ask

How do I fix missing frozen string literal comment?

The property can be found here: FrozenStringLiteral. This change just silences the warning. The linked page describes the right solution: Add the frozen_string_literal comment to the top of files to help transition to frozen string literals by default. .

What is a frozen string literal comment?

Starting with Ruby 2.3, if you add the magic comment # frozen_string_literal: true to the file, the string literal for greeting is then automatically frozen (meaning it can't be modified). This means that if name is present and we try to personalize the greeting, a runtime error will be raised.


1 Answers

This one worked for me

Style/FrozenStringLiteralComment:   Enabled: false 
like image 165
mpalencia Avatar answered Oct 05 '22 04:10

mpalencia