2016-05-14 33 views

回答

59

在你的代碼,你可以禁用一堆線這樣的:

# rubocop:disable LineLength 
puts "This line is lonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnng" 
# rubocop:enable LineLength 
使用

目前或者添加到您的.rubocop.yml文件,以增加最大長度:

Metrics/LineLength: 
    Max: 100 
+0

我在哪裏可以把這個? – Abram

+1

所以我複製這個文件https://github.com/bbatsov/rubocop/blob/master/config/default.yml,並作出改變,並重新啓動崇高,但仍然看到問題.. – Abram

+3

啊,我看到我去了哪裏錯誤。我在'.rubocop.yml'中忘了''。現在開始工作了,謝謝! – Abram

31

使用.rubocop.yml文件,你有一大堆的選擇:

Metrics/LineLength: 
    # This will disable the rule completely, regardless what other options you put 
    Enabled: false 
    # Change the default 80 chars limit value 
    Max: 120 
    # If you want the rule only apply to a specific folder/file 
    Include: 
    - 'app/**/*' 
    # If you want the rule not to apply to a specific folder/file 
    Exclude: 
    - 'db/schema.rb'