def print_summary(ui)
      # Print whether it passed/failed at the top
      if failed?
        ui.puts "\n[!] Failed\n".red
      else
        ui.notice "Passed"
      end

      # A generic proc to handle the similarities between
      # errors and warnings.
      do_rules = proc do |name, rules|
        unless rules.empty?
          ui.puts ""
          ui.section(name.bold) do
            rules.each do |rule|
              title = rule.title.bold + " - #{rule.object_applied_to}"
              subtitles = [rule.description, link(rule.ref)]
              subtitles += [rule.metadata[:files].join(":")] if rule.metadata[:files]
              ui.labeled(title, subtitles)
              ui.puts ""
            end
          end
        end
      end

      # Run the rules
      do_rules.call("Errors".red, errors)
      do_rules.call("Warnings".yellow, warnings)
    end
def print_summary(ui)
      # Print whether it passed/failed at the top
      if failed?
        ui.puts "\n[!] Failed\n".red
      else
        ui.notice "Passed"
      end

      # A generic proc to handle the similarities between
      # errors and warnings.
      do_rules = proc do |name, rules|
        unless rules.empty?
          ui.puts ""
          ui.section(name.bold) do
            rules.each do |rule|
              title = rule.title.bold + " - #{rule.object_applied_to}"
              subtitles = [rule.description, link(rule.ref)]
              subtitles += [rule.metadata[:files].join(":")] if rule.metadata[:files]
              ui.labeled(title, subtitles)
              ui.puts ""
            end
          end
        end
      end

      # Run the rules
      do_rules.call("Errors".red, errors)
      do_rules.call("Warnings".yellow, warnings)
    end
Prints a summary of the errors and warnings.