Sha256: aaecc37b582d6e7a4c68fc4c81f31528b0c155a9a26715bb6ca66732e7adb03c
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
require 'pronto' require_relative 'luacheck/wrapper' module Pronto class LuacheckRunner < Runner def initialize(_, __ = nil) super @inspector = ::Pronto::Luacheck::Wrapper.new end def run return [] unless @patches @patches.select { |patch| valid_patch?(patch) } .map { |patch| inspect(patch) } .flatten .compact end private def valid_patch?(patch) return false if patch.additions < 1 lua_file?(patch) end def lua_file?(patch) patch.new_file_full_path.to_s.end_with?('.lua') end def inspect(patch) offences = @inspector.run(patch.new_file_full_path.to_s) offences.map do |offence| patch.added_lines .select { |line| line.new_lineno == offence[:line] } .map { |line| new_message(offence, line) } end end def new_message(offence, line) path = line.patch.delta.new_file[:path] Message.new(path, line, offence[:level], offence[:message], nil, self.class) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pronto-luacheck-1.0.1 | lib/pronto/luacheck_runner.rb |
pronto-luacheck-1.0.0 | lib/pronto/luacheck_runner.rb |
pronto-luacheck-0.1.0 | lib/pronto/luacheck_runner.rb |