swiftPmEvidence function

String swiftPmEvidence(
  1. PluginEntry plugin
)

A one-line summary of the evidence behind swiftPmStatus (SPEC ยง3.2: "shows the evidence behind its colour").

Implementation

String swiftPmEvidence(PluginEntry plugin) {
  if (plugin.errors.isNotEmpty) return 'Could not be checked.';
  if (plugin.swiftpm.nativeIos == false) {
    return plugin.swiftpm.reason == 'not-ios-plugin'
        ? 'Not affected: not an iOS plugin.'
        : 'Not affected: no native iOS code.';
  }
  final tag = plugin.swiftpm.tag;
  final archive = plugin.swiftpm.archive;
  final checkedPackage = plugin.swiftpm.checkedPackage ?? plugin.name;
  if (tag == null || archive == null) return 'Could not be checked.';
  if (tag == archive) {
    return archive
        ? 'Package.swift found in the $checkedPackage archive.'
        : 'No Package.swift in the $checkedPackage archive.';
  }
  return 'pub.dev tag ($tag) disagrees with the $checkedPackage archive ($archive).';
}