Method: Inspec::Reporters::CLI::Control#title_for_report

Defined in:
lib/inspec/reporters/cli.rb

#title_for_reportObject



466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
# File 'lib/inspec/reporters/cli.rb', line 466

def title_for_report
  # if this is an anonymous control, just grab the resource title from any result entry
  return results.first[:resource_title] if anonymous?

  title_for_report = "#{id}: #{title || results.first[:resource_title]}"

  # we will not add any additional data to the title if there's only
  # zero or one test for this control.
  return title_for_report if results.nil? || results.size <= 1

  # append a failure summary if appropriate.
  title_for_report += " (#{failure_count} failed)" if failure_count > 0
  title_for_report += " (#{skipped_count} skipped)" if skipped_count > 0
  title_for_report
end