Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fix `Missing frozen string literal comment` issue

I created a new migration, it looks like this one:

class AddCommentsToUsers < ActiveRecord::Migration
  def change
    add_column :users, :comments, :text
  end
end

Now with Code Climate I am warned of an issue: Missing frozen string literal comment.

I tried to fix it like this:

# frozen_string_literal: true
class AddCommentsToUsers < ActiveRecord::Migration
  def change
    add_column :users, :comments, :text
  end
end

But I still have the same issue. How can I solve it? Thanks.

like image 458
John Smith Avatar asked May 09 '16 18:05

John Smith


1 Answers

I experienced the same problem. Rubocop was working fine before but suddenly it started acting up. I read through their configuration options on github and saw the particular property that is messing with your code. The property can be found here: FrozenStringLiteral.

To silence this warning, you only need to add this to your rubocop.yml file

Style/FrozenStringLiteralComment:
  Enabled: false
like image 52
Van_Paitin Avatar answered Sep 19 '22 01:09

Van_Paitin