class Pronto::ProntoSimplecov::Runner

Public Instance Methods

coverage() click to toggle source
# File lib/pronto/pronto_simplecov/runner.rb, line 24
def coverage
  @coverage ||= begin
                  merged_result = SimpleCov::ResultMerger.merged_result
                  return {} if merged_result.nil?
                  Hash[merged_result.files.map { |file| [file.filename, file] }]
                end
end
message(line) click to toggle source
# File lib/pronto/pronto_simplecov/runner.rb, line 19
def message(line)
  path = line.patch.delta.new_file[:path]
  Message.new(path, line, :error, 'This change has no test coverage', nil, self.class)
end
process(patch) click to toggle source
# File lib/pronto/pronto_simplecov/runner.rb, line 11
def process(patch)
  file_coverage = coverage[patch.new_file_full_path.to_s]
  return unless file_coverage
  patch.added_lines
       .select { |line| file_coverage.line(line.new_lineno)&.missed? }
       .map { |line| message(line) }
end
run() click to toggle source
# File lib/pronto/pronto_simplecov/runner.rb, line 4
def run
  return [] unless @patches
  return [] if coverage.empty?
  @patches.map { |patch| process(patch) }
          .flatten.compact
end