Reputation: 1350
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?
Upvotes: 38
Views: 45094
Reputation: 71
Using the file .rubocop.yml you can add this code to disable it:
Metrics/ClassLength:
Enabled: false
You can find more information about it in the rubocop configuration page
Upvotes: 4
Reputation: 788
when disabling, be sure to enable again
# rubocop:disable ClassLength
class LongClass
end
# rubocop:enable ClassLength
references:
Upvotes: 22
Reputation: 23939
Or in .rubocop.yml
:
Metrics/ClassLength:
Exclude:
- "path/to/your/file.rb"
Upvotes: 18