Parent

Methods

Files

Class/Module Index [+]

Quicksearch

RuboCop::Cop::Style::LineLength

This cop checks the length of lines in the source code. The maximum length is configurable.

Constants

MSG

Public Instance Methods

investigate(processed_source) click to toggle source
# File lib/rubocop/cop/style/line_length.rb, line 12
def investigate(processed_source)
  processed_source.lines.each_with_index do |line, index|
    next unless line.length > max

    message = format(MSG, line.length, max)
    add_offense(nil,
                source_range(processed_source.buffer,
                             processed_source[0...index], max,
                             line.length - max),
                message) do
      self.max = line.length
    end
  end
end
max() click to toggle source
# File lib/rubocop/cop/style/line_length.rb, line 27
def max
  cop_config['Max']
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.