describe method

String describe()

A report for a person: what is wrong, and what to do about each.

Implementation

String describe() {
  if (ok) return 'class path verified: $jarCount jars, everything in place.';
  final out = StringBuffer('class path invalid ($jarCount jars):\n');
  for (final MapEntry(:key, :value) in unreadable.entries) {
    out.writeln('  - unreadable: $key ($value)');
  }
  for (final MapEntry(:key, :value) in missingClasses.entries) {
    out.writeln('  - missing class: $key — expected from $value');
  }
  for (final resource in missingResources) {
    out.writeln('  - missing resource: $resource');
  }
  for (final MapEntry(:key, :value) in wrongResourceContent.entries) {
    out.writeln(
      '  - $key is present, but no copy contains "$value" — the jar '
      'whose copy does is missing, or a merge kept another jar\'s',
    );
  }
  for (final MapEntry(:key, :value) in forbiddenFound.entries) {
    out.writeln('  - forbidden class present: $key — remove $value');
  }
  return out.toString();
}