class Pronto::TailorRunner
Public Class Methods
new()
click to toggle source
# File lib/pronto/tailor.rb, line 7 def initialize end
Public Instance Methods
run(patches, _)
click to toggle source
# File lib/pronto/tailor.rb, line 10 def run(patches, _) return [] unless patches patches.select { |p| p.additions > 0 } .select { |p| swift_file?(p.new_file_full_path) } .map { |p| inspect(p) } .flatten .compact end
Private Instance Methods
inspect(patch)
click to toggle source
# File lib/pronto/tailor.rb, line 21 def inspect(patch) offences = Tailor::Wrapper.new(patch).lint messages = [] offences.each do |offence| messages += patch .added_lines .select { |line| line.new_lineno == offence['line'] } .map { |line| new_message(offence, line) } end messages.compact end
new_message(offence, line)
click to toggle source
# File lib/pronto/tailor.rb, line 33 def new_message(offence, line) path = line.patch.delta.new_file[:path] Message.new(path, line, offence['level'].to_sym, offence['message']) end
swift_file?(path)
click to toggle source
# File lib/pronto/tailor.rb, line 38 def swift_file?(path) %w(.swift).include?(File.extname(path)) end