Skip to content

Commit 6e39497

Browse files
committed
Reverted file to original except logging of exception
1 parent cedbacb commit 6e39497

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/coverlet.msbuild.tasks/CoverageResultTask.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class CoverageResultTask : Task
1818
private double _threshold;
1919
private string _thresholdType;
2020
private string _thresholdStat;
21-
private MSBuildLogger _logger;
21+
private ILogger _logger;
2222

2323
[Required]
2424
public string Output
@@ -64,7 +64,7 @@ public override bool Execute()
6464
{
6565
try
6666
{
67-
Console.WriteLine("Calculating coverage result...");
67+
Console.WriteLine("\nCalculating coverage result...");
6868

6969
var coverage = InstrumentationTask.Coverage;
7070
var result = coverage.GetCoverageResult();
@@ -91,7 +91,7 @@ public override bool Execute()
9191
if (reporter.OutputType == ReporterOutputType.Console)
9292
{
9393
// Output to console
94-
Console.WriteLine("Outputting results to console");
94+
Console.WriteLine(" Outputting results to console");
9595
Console.WriteLine(reporter.Report(result));
9696
}
9797
else
@@ -102,14 +102,14 @@ public override bool Execute()
102102
filename = Path.HasExtension(filename) ? filename : $"{filename}.{reporter.Extension}";
103103

104104
var report = Path.Combine(directory, filename);
105-
Console.WriteLine($"Generating report '{report}'");
105+
Console.WriteLine($" Generating report '{report}'");
106106
File.WriteAllText(report, reporter.Report(result));
107107
}
108108
}
109109

110110
var thresholdTypeFlags = ThresholdTypeFlags.None;
111111
var thresholdStat = ThresholdStatistic.Minimum;
112-
112+
113113
foreach (var thresholdType in _thresholdType.Split(',').Select(t => t.Trim()))
114114
{
115115
if (thresholdType.Equals("line", StringComparison.OrdinalIgnoreCase))
@@ -138,7 +138,7 @@ public override bool Execute()
138138
var coverageTable = new ConsoleTable("Module", "Line", "Branch", "Method");
139139
var summary = new CoverageSummary();
140140
int numModules = result.Modules.Count;
141-
141+
142142
var totalLinePercent = summary.CalculateLineCoverage(result.Modules).Percent * 100;
143143
var totalBranchPercent = summary.CalculateBranchCoverage(result.Modules).Percent * 100;
144144
var totalMethodPercent = summary.CalculateMethodCoverage(result.Modules).Percent * 100;
@@ -152,12 +152,13 @@ public override bool Execute()
152152
coverageTable.AddRow(Path.GetFileNameWithoutExtension(module.Key), $"{linePercent}%", $"{branchPercent}%", $"{methodPercent}%");
153153
}
154154

155+
Console.WriteLine();
155156
Console.WriteLine(coverageTable.ToStringAlternative());
156157

157158
coverageTable.Columns.Clear();
158159
coverageTable.Rows.Clear();
159160

160-
coverageTable.AddColumn(new [] { "", "Line", "Branch", "Method"});
161+
coverageTable.AddColumn(new[] { "", "Line", "Branch", "Method" });
161162
coverageTable.AddRow("Total", $"{totalLinePercent}%", $"{totalBranchPercent}%", $"{totalMethodPercent}%");
162163
coverageTable.AddRow("Average", $"{totalLinePercent / numModules}%", $"{totalBranchPercent / numModules}%", $"{totalMethodPercent / numModules}%");
163164

0 commit comments

Comments
 (0)