Class: KafoModuleLint::Linter

Inherits:
Object
  • Object
show all
Defined in:
lib/kafo_module_lint/linter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Linter

Returns a new instance of Linter.



9
10
11
# File 'lib/kafo_module_lint/linter.rb', line 9

def initialize(path)
  @path = File.expand_path(path)
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/kafo_module_lint/linter.rb', line 7

def path
  @path
end

Instance Method Details

#errorsObject



17
18
19
20
21
22
23
24
25
# File 'lib/kafo_module_lint/linter.rb', line 17

def errors
  @errors ||= begin
    errors = []
    parsed[:types].each do |param,type|
      check_param(param, type, errors)
    end unless skip?
    errors
  end
end

#pass?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/kafo_module_lint/linter.rb', line 13

def pass?
  skip? || errors.empty?
end

#puts_errorsObject



27
28
29
# File 'lib/kafo_module_lint/linter.rb', line 27

def puts_errors
  errors.each { |e| puts e }
end