Skip to content

Commit 42eff34

Browse files
committed
Merge branch 'master' of github.com:tonerdo/coverlet
2 parents dabc081 + 2844fe3 commit 42eff34

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/coverlet.core/Coverage.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ private void CalculateCoverage()
9393
{
9494
foreach (var result in _results)
9595
{
96+
if (!File.Exists(result.HitsFilePath)) { continue; }
9697
var lines = File.ReadAllLines(result.HitsFilePath);
9798
for (int i = 0; i < lines.Length; i++)
9899
{

src/coverlet.core/CoverageSummary.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public CoverageSummary(CoverageResult result)
1212
public CoverageSummaryResult CalculateSummary()
1313
{
1414
CoverageSummaryResult result = new CoverageSummaryResult();
15+
int totalModuleLines = 0, moduleLinesCovered = 0;
16+
1517
foreach (var mod in _result.Modules)
1618
{
1719
int totalLines = 0, linesCovered = 0;
@@ -30,10 +32,11 @@ public CoverageSummaryResult CalculateSummary()
3032
}
3133
}
3234
}
33-
35+
totalModuleLines += totalLines;
36+
moduleLinesCovered += linesCovered;
3437
result.Add(System.IO.Path.GetFileNameWithoutExtension(mod.Key), (linesCovered * 100) / totalLines);
3538
}
36-
39+
result.Add("Covered", (moduleLinesCovered * 100) / totalModuleLines);
3740
return result;
3841
}
3942
}

0 commit comments

Comments
 (0)