2016-05-14 11 views

Odpowiedz

59

W kodzie można wyłączyć kilka linii tak:

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

lub dodać do pliku .rubocop.yml aby zwiększyć długość maksymalna:

Metrics/LineLength: 
    Max: 100 
+0

Gdzie mogę umieścić to? – Abram

+1

Więc skopiowałem ten plik https://github.com/bbatsov/rubocop/blob/master/config/default.yml i wprowadziłem zmianę i ponownie uruchomiłem sublime, ale nadal widzę problem .. – Abram

+3

Ah, widzę, gdzie poszedłem źle. Zapomniałem '.' w' .rubocop.yml' Rozumiem, dziękuję! – Abram

31

użyciu pliku .rubocop.yml, masz kilka opcji:

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' 
Powiązane problemy