2016-05-14 5 views

Antwort

59

In Ihrem Code können Sie ein paar Zeilen wie diese deaktivieren:

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

Oder fügen Sie diese zu Ihrer .rubocop.yml Datei, die die maximale Länge zu erhöhen:

Metrics/LineLength: 
    Max: 100 
+0

Wo soll ich sagen? – Abram

+1

Also ich kopierte diese Datei https://github.com/bbatsov/rubocop/blob/master/config/default.yml und machte die Änderung und neu gestartet erhaben, aber immer noch das Problem .. – Abram

+3

Ah, ich sehe, wo ich hinging falsch. Ich habe das '.' in' .rubocop.yml vergessen. – Abram

31

eine .rubocop.yml Datei verwenden, haben Sie eine Reihe von Optionen:

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'