Sha256: 6bfa2fa463b8019d13ae6786d9e08d72687612cda76b83555e66ff243c9b7c82
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
require 'pronto' require 'haml_lint' module Pronto class Haml < Runner def run return [] unless @patches @patches.select { |patch| patch.additions > 0 } .select { |patch| haml_file?(patch.new_file_full_path) } .map { |patch| inspect(patch) } .flatten.compact end def inspect(patch) lints = runner.run(files: [patch.new_file_full_path.to_s], reporter: reporter).lints lints.map do |lint| patch.added_lines.select { |line| line.new_lineno == lint.line } .map { |line| new_message(lint, line) } end end def new_message(lint, line) path = line.patch.delta.new_file[:path] Message.new(path, line, lint.severity.name, lint.message, nil, self.class) end private def haml_file?(path) File.extname(path) == '.haml' end def reporter @reporter ||= ::HamlLint::Reporter::DefaultReporter.new( ::HamlLint::Logger.new(StringIO.new) ) end def runner @runner ||= ::HamlLint::Runner.new end end end
Version data entries
5 entries across 5 versions & 1 rubygems