Sha256: 338ea892df956204cac16928d385df1c1a985761bfdd1e3e6d78085dc8e7f652
Contents?: true
Size: 882 Bytes
Versions: 4
Compression:
Stored size: 882 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| max = LineLength.max if line.length > max message = sprintf(MSG, line.length, max) add_offence(:convention, source_range(processed_source.buffer, processed_source[0...index], max, line.length - max), message) end end end def self.max LineLength.config['Max'] end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems