Class: Cane::StyleCheck

Inherits:
Struct
  • Object
show all
Defined in:
lib/cane/style_check.rb

Overview

Creates violations for files that do not meet style conventions. Only highly obvious, probable, and non-controversial checks are performed here. It is not the goal of the tool to provide an extensive style report, but only to prevent studid mistakes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optsObject

Returns the value of attribute opts

Returns:

  • (Object)

    the current value of opts



9
10
11
# File 'lib/cane/style_check.rb', line 9

def opts
  @opts
end

Instance Method Details

#violationsObject



10
11
12
13
14
15
16
17
18
# File 'lib/cane/style_check.rb', line 10

def violations
  file_list.map do |file_path|
    map_lines(file_path) do |line, line_number|
      violations_for_line(line.chomp).map do |message|
        StyleViolation.new(file_path, line_number + 1, message)
      end
    end
  end.flatten
end