printCov function
void
printCov()
printCoverage.
Generate coverage test report from lcov.info file to console.
lines
is the list of string from lcov.info file
files
is the list of file in string that already filter by exclude params.
module
is the module name
isCsv
is whether it will print to console or csv file
isSummary
is whether it will print the total coverage only or not
min
is it will print whether total coverage is passed/failed from this value
isLineOnly
is it will print Lines & Uncovered Lines only
Implementation
void printCov(List<String> lines, List<FileEntity> files, String module,
bool isCsv, bool isSummary, int min, bool isLineOnly) {
final dataList = _getCoverage(lines, files);
final totalData = dataList[PrintCovConstants.allFiles]!;
if (isSummary) {
final mdl = module.isEmpty ? '' : '$module : ';
if (min > 0) {
final cov = 100 * totalData.linesHit / totalData.linesFound;
if (cov >= min) {
print('${mdl}PASSED');
} else {
print('${mdl}FAILED');
}
} else {
final cov = _formatPercent(totalData.linesHit, totalData.linesFound);
print('$mdl$cov');
}
return;
}
_printHeader(isCsv, isLineOnly, module);
String lastDir = PrintCovConstants.emptyString;
if (files.isEmpty) {
for (final data in dataList.values) {
if (data != totalData) {
lastDir = _printDir(data, data.file, lastDir, isCsv, isLineOnly);
}
}
} else {
for (final file in files) {
lastDir = _printDir(
dataList[file.toString()], file, lastDir, isCsv, isLineOnly);
}
}
_printTotal(isCsv, isLineOnly, totalData);
}