Search code examples
ruby-on-railsrubocop

Rubocop - disable long length for commented code


Don't know why but rubocop takes the length of the line in the comment and show we an error:

config/initializers/devise.rb:116:121: C: Layout/LineLength: Line is too long. [150/120]
  # config.secret_key = '0cfe0f176132fc4ef87b7fc01d8e65b31a74d3e41d5df18cccd20d1a65f447a28d41744cf8ed9e99a704c449f930673f297fe2ee4dbffa7c7162ba24baa5359a'
                                                                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Should I disable it in .rubocop.yml somehow?


Solution

  • Layout/LineLength:
      Max: 150 (for example)
    

    or disable this cop at all

    Layout/LineLength:
      Enabled: false
    

    or there is an option to ignore lines which start from certain character:

    Metrics/LineLength:
      Max: 80
      IgnoredPatterns: ['(\A|\s)#']