Reputation: 2900
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?
Upvotes: 1
Views: 962
Reputation: 2184
The accepted answer is now obsolete because Rubocop questionably changed IgnoredPatterns
to AllowedPatterns
.
The following configuration worked for me:
Layout/LineLength:
AllowedPatterns: ['^(\s*#)']
This regex only works when the entire line is commented out. Code followed by a long comment on the same line will still trigger a Rubocop lint error, which is by design.
Upvotes: 1
Reputation: 1920
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)#']
Upvotes: 7