Class: Rubocop::Cop::LineLength
- Defined in:
- lib/rubocop/cop/line_length.rb
Constant Summary collapse
- ERROR_MESSAGE =
'Line is too long. [%d/%d]'
- MAX_LINE_LENGTH =
79
Instance Attribute Summary
Attributes inherited from Cop
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, enabled?, #has_report?, inherited, #initialize, #inspect_source
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#inspect(file, source) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/rubocop/cop/line_length.rb', line 9 def inspect(file, source) source.each_with_index do |line, index| if line.length > MAX_LINE_LENGTH = sprintf(ERROR_MESSAGE, line.length, MAX_LINE_LENGTH) add_offence(:convention, index, line, ) end end end |