Sha256: 932e660dbcfd7794432b7ec543e96af6d47fdc0ac1acf20e3cef7087134ef4db
Contents?: true
Size: 1011 Bytes
Versions: 1
Compression:
Stored size: 1011 Bytes
Contents
require 'kafo_parsers/parsers' require 'kafo/data_type' require 'kafo/exceptions' module KafoModuleLint class Linter attr_reader :path def initialize(path) @path = File.expand_path(path) end def pass? errors.empty? end def errors @errors ||= begin errors = [] parsed[:types].each do |param,type| check_param(param, type, errors) end errors end end def puts_errors errors.each { |e| puts e } end private def self.parser @parser ||= KafoParsers::Parsers.find_available end def parsed @parsed ||= self.class.parser.parse(path) end 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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kafo_module_lint-1.3.0 | lib/kafo_module_lint/linter.rb |