我创建了一个新的迁移,它看起来像这样:
class AddCommentsToUsers < ActiveRecord::Migration
def change
add_column :users, :comments, :text
end
end
现在有了Code Climate,我被警告了一个问题:
Missing frozen string literal comment.
我试着像这样修理它:
# frozen_string_literal: true
class AddCommentsToUsers < ActiveRecord::Migration
def change
add_column :users, :comments, :text
end
end
但我仍有同样的问题。我该如何解决?谢谢。
答案 0 :(得分:7)
我遇到了同样的问题。 Rubocop之前工作得很好,但突然间它开始起作用了。我在github上阅读了他们的配置选项,看到了弄乱你的代码的特定属性。 该物业可在此处找到:FrozenStringLiteral。
要解决此问题,您只需将其添加到rubocop.yml
文件
Style/FrozenStringLiteralComment:
Enabled: false