Skip to content

Commit

Permalink
Add global coverage row
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Balant committed Mar 23, 2018
1 parent 2fd1753 commit 2e4bb8c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/coverlet.core/CoverageSummary.cs
Expand Up @@ -12,6 +12,8 @@ public CoverageSummary(CoverageResult result)
public CoverageSummaryResult CalculateSummary()
{
CoverageSummaryResult result = new CoverageSummaryResult();
int totalModuleLines = 0, moduleLinesCovered = 0;

foreach (var mod in _result.Modules)
{
int totalLines = 0, linesCovered = 0;
Expand All @@ -30,10 +32,11 @@ public CoverageSummaryResult CalculateSummary()
}
}
}

totalModuleLines += totalLines;
moduleLinesCovered += linesCovered;
result.Add(System.IO.Path.GetFileNameWithoutExtension(mod.Key), (linesCovered * 100) / totalLines);
}

result.Add("Covered", (moduleLinesCovered * 100) / totalModuleLines);
return result;
}
}
Expand Down

0 comments on commit 2e4bb8c

Please sign in to comment.