class Pronto::Rustcov

def group_patches(patches, lcov)

def group_patches(patches, lcov)
  grouped = Hash.new { |h, k| h[k] = [] }
  patches.each do |patch|
    next unless patch.added_lines.any?
    file_path = patch.new_file_full_path.to_s
    uncovered = lcov[file_path]
    next unless uncovered
    patch.added_lines.each do |line|
      if uncovered.include?(line.new_lineno)
        grouped[patch].push(line)
      end
    end
  end
  grouped.sort_by { |_, lines| -lines.count }.take(pronto_files_limit)
end