class KafoModuleLint::Linter
Attributes
path[R]
Public Class Methods
new(path)
click to toggle source
# File lib/kafo_module_lint/linter.rb, line 9 def initialize(path) @path = File.expand_path(path) end
Private Class Methods
parser()
click to toggle source
# File lib/kafo_module_lint/linter.rb, line 33 def self.parser @parser ||= KafoParsers::Parsers.find_available end
Public Instance Methods
errors()
click to toggle source
# 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?()
click to toggle source
# File lib/kafo_module_lint/linter.rb, line 13 def pass? skip? || errors.empty? end
puts_errors()
click to toggle source
# File lib/kafo_module_lint/linter.rb, line 27 def puts_errors errors.each { |e| puts e } end
Private Instance Methods
check_param(param, type, errors)
click to toggle source
# File lib/kafo_module_lint/linter.rb, line 41 def check_param(param, type, errors) return true if type == 'password' # special case begin Kafo::DataType.new_from_string(type) true rescue Kafo::ConfigurationException, ArgumentError => e errors << "#{path} parameter #{param}: #{e.message}" false end end
parsed()
click to toggle source
# File lib/kafo_module_lint/linter.rb, line 37 def parsed @parsed ||= self.class.parser.parse(path) end
skip?()
click to toggle source
# File lib/kafo_module_lint/linter.rb, line 52 def skip? # kafo_parsers doesn't support 3.x future parser ENV['FUTURE_PARSER'] == 'yes' end