Class: RubyAppraiser::Adapter::LineLength

Inherits:
RubyAppraiser::Adapter show all
Defined in:
lib/ruby-appraiser/adapter/line-length.rb

Instance Method Summary collapse

Methods inherited from RubyAppraiser::Adapter

adapter_type, all, attempt_require_adapter, find, find!, get, inherited, #initialize, registry

Constructor Details

This class inherits a constructor from RubyAppraiser::Adapter

Instance Method Details

#appraiseObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ruby-appraiser/adapter/line-length.rb', line 6

def appraise
  source_files.each do |source_file|
    File.open(source_file) do |source|
      source.lines.each_with_index do |line, number|
        line_length = line.chomp.length
        if line_length > 80
          add_defect(source_file, number,
                     "Line too long [#{line_length}/80]")
        end
      end
    end
  end
end