Sha256: f44299125937d7facbf28b0163859b2e9d2cb813d65607fd80345a5ebb0dc79a

Contents?: true

Size: 824 Bytes

Versions: 5

Compression:

Stored size: 824 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Style
      # This cop checks the length of lines in the source code.
      # The maximum length is configurable.
      class LineLength < Cop
        MSG = 'Line is too long. [%d/%d]'

        def investigate(processed_source)
          processed_source.lines.each_with_index do |line, index|
            if line.length > max
              message = sprintf(MSG, line.length, max)
              convention(nil,
                         source_range(processed_source.buffer,
                                      processed_source[0...index], max,
                                      line.length - max),
                         message)
            end
          end
        end

        def max
          cop_config['Max']
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-0.15.0 lib/rubocop/cop/style/line_length.rb
rubocop-0.14.1 lib/rubocop/cop/style/line_length.rb
rubocop-0.14.0 lib/rubocop/cop/style/line_length.rb
rubocop-0.13.1 lib/rubocop/cop/style/line_length.rb
rubocop-0.13.0 lib/rubocop/cop/style/line_length.rb