class Steep::Drivers::Check

def print_result(project:, notifications:)

def print_result(project:, notifications:)
  if notifications.all? {|notification| notification[:diagnostics].empty? }
    emoji = %w(🫖 🫖 🫖 🫖 🫖 🫖 🫖 🫖 🍵 🧋 🧉).sample
    stdout.puts Rainbow("No type error detected. #{emoji}").green.bold
    0
  else
    errors = notifications.reject {|notification| notification[:diagnostics].empty? }
    total = errors.sum {|notification| notification[:diagnostics].size }
    errors.each do |notification|
      path = Steep::PathHelper.to_pathname(notification[:uri]) or raise
      buffer = RBS::Buffer.new(name: project.relative_path(path), content: path.read)
      printer = DiagnosticPrinter.new(buffer: buffer, stdout: stdout)
      notification[:diagnostics].each do |diag|
        printer.print(diag)
        stdout.puts
      end
    end
    stdout.puts Rainbow("Detected #{total} #{"problem".pluralize(total)} from #{errors.size} #{"file".pluralize(errors.size)}").red.bold
    1
  end
end