summary static method

String summary(
  1. PipeRunResult result
)

The one-line summary of a run, e.g. 1 of 7 steps failed, 2 skipped - 2m 10s

Implementation

static String summary(PipeRunResult result) {
  int total = result.steps.length;
  List<String> parts = [];
  if (result.hasFailures) {
    parts.add("${result.failedSteps.length} of $total step${total == 1 ? "" : "s"} failed");
  } else {
    parts.add(total == 1 ? "The step succeeded" : "All $total steps succeeded");
  }
  if (result.skippedSteps.isNotEmpty) {
    parts.add("${result.skippedSteps.length} skipped");
  }
  if (result.warningCount > 0) {
    parts.add("${result.warningCount} warning${result.warningCount == 1 ? "" : "s"}");
  }
  return "${parts.join(", ")} - ${duration(result.elapsed)}";
}