totalTechDebt function
Implementation
String totalTechDebt(Iterable<LintFileReport> records) {
final debtValue = records.fold<num>(
0,
(prevValue, fileReport) =>
prevValue +
(fileReport.file?.metric(TechnicalDebtMetric.metricId)?.value ?? 0),
);
final debtUnitType = records
.firstWhereOrNull(
(record) =>
record.file?.metric(TechnicalDebtMetric.metricId) != null,
)
?.file
?.metric(TechnicalDebtMetric.metricId)
?.unitType ??
'';
return debtValue > 0 ? '$debtValue $debtUnitType'.trim() : 'not found';
}