I have a class with constants, many constants. And rubocop is complaining about the length of this Class, which I don't care how long it gets.
I want to disable rubocop's error: "Class has too many lines" but the following is not working:
# rubocop:disable ClassLength
Also, the following isn't either:
# rubocop:disable Metrics/ClassLength
What is the correct metric that I need to disable?
Try
class Xzy # rubocop:disable Metrics/ClassLength
when disabling, be sure to enable again
# rubocop:disable ClassLength
class LongClass
end
# rubocop:enable ClassLength
references:
rubocop/lib/rubocop/cop/metrics/class_length.rb
disabling-cops-within-source-code
in .rubocop.yml
:
Metrics/MethodLength:
Max: 1000
Or in .rubocop.yml
:
Metrics/ClassLength:
Exclude:
- "path/to/your/file.rb"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With