countByPriority method
Returns a map of priority → total occurrence count (sum of all issues whose rule maps to that priority).
Implementation
Map<IssuePriority, int> countByPriority(List<PrioritizedGroup> groups) {
final counts = <IssuePriority, int>{};
for (final g in groups) {
counts[g.priority] = (counts[g.priority] ?? 0) + g.occurrenceCount;
}
return counts;
}