swiftPmGreenSharePercent function
Share of plugins with a known SwiftPM status (green/amber/red — excludes
"not checked") that are fully SwiftPM-ready, as a whole percent. Used for
the trend view (SPEC §3.2: "trend over time ... share of top plugins that
ship SwiftPM"). Returns null when no plugin in plugins has a known status.
Implementation
int? swiftPmGreenSharePercent(List<PluginEntry> plugins) {
final known = plugins
.where((p) => swiftPmStatus(p) != Status.notChecked)
.toList();
if (known.isEmpty) return null;
final green = known.where((p) => swiftPmStatus(p) == Status.green);
return (green.length / known.length * 100).round();
}