Sha256: 0af7e1eeb39cc4b9ac8a6ac093b0b0d7a32e602e2d46413810487569c9b41843

Contents?: true

Size: 549 Bytes

Versions: 12

Compression:

Stored size: 549 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    class LineLength < Cop
      ERROR_MESSAGE = 'Line is too long. [%d/%d]'

      def inspect(file, source, tokens, sexp)
        source.each_with_index do |line, index|
          max = LineLength.max
          if line.length > max
            message = sprintf(ERROR_MESSAGE, line.length, max)
            add_offence(:convention, index + 1, message)
          end
        end
      end

      def self.max
        LineLength.config ? LineLength.config['Max'] || 79 : 79
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rubocop-0.6.1 lib/rubocop/cop/line_length.rb
rubocop-0.6.0 lib/rubocop/cop/line_length.rb
rubocop-0.5.0 lib/rubocop/cop/line_length.rb
rubocop-0.4.6 lib/rubocop/cop/line_length.rb
rubocop-0.4.5 lib/rubocop/cop/line_length.rb
rubocop-0.4.4 lib/rubocop/cop/line_length.rb
rubocop-0.4.3 lib/rubocop/cop/line_length.rb
rubocop-0.4.2 lib/rubocop/cop/line_length.rb
rubocop-0.4.1 lib/rubocop/cop/line_length.rb
rubocop-0.4.0 lib/rubocop/cop/line_length.rb
rubocop-0.3.2 lib/rubocop/cop/line_length.rb
rubocop-0.3.1 lib/rubocop/cop/line_length.rb