【问题标题】:'C: Carriage return character detected' for 'module WareHouse' in RubocopRubocop 中的“模块仓库”的“C:检测到回车符”
【发布时间】:2015-10-29 07:16:34
【问题描述】:

我在我的应用程序中使用rubocop。我面临的问题是C: Carriage return character detected.

这是我的代码。

module WareHouse
  class Stuff < ActiveRecord::Base
    # my code goes here
  end
end

谁能帮我解决这个问题?

【问题讨论】:

  • 可能你已经为 git 运行了一个命令(它在git diff 中显示了一些特殊字符)。请检查。

标签: ruby-on-rails-3 module rubocop


【解决方案1】:

这意味着您的代码中有一个 Windows 样式的行尾。如果您需要与使用 Mac 或 Linux 机器的其他开发人员合作,这可能会导致问题。

http://www.rubydoc.info/github/bbatsov/rubocop/Rubocop/Cop/Style/EndOfLine

如果你不关心这个,你可以禁用或修改 EndOfLine 规则的配置:

https://github.com/bbatsov/rubocop/blob/master/config/default.yml#L476

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-08-12
    • 2015-07-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-26
    • 2013-04-26
    相关资源
    最近更新 更多