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

Answers


This one worked for me

Style/FrozenStringLiteralComment:
  Enabled: false

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.


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

Further to this, If you don't want any magic frozen_string_literal comments, you can use this:

Style/FrozenStringLiteralComment:
  EnforcedStyle: never

Need Your Help

How can I clear the content of a file?

c# .net file clear

I need to clear the contents of a particular file every time the applications starts. How do I do it?

Better way to check if a Path is a File or a Directory?

c# .net file path directory

I am processing a TreeView of directories and files. A user can select either a file or a directory and then do something with it. This requires me to have a method which performs different actions...