Skip to content

Commit b5c7587

Browse files
authored
Merge pull request #154 from alexanderkozlenko/pr_msbuild_case
Make enumeration-based MSBuild properties case-insensitive
2 parents d4890a6 + 5475606 commit b5c7587

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/coverlet.core/Reporters/ReporterFactory.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Linq;
23
using System.Collections.Generic;
34

@@ -18,6 +19,6 @@ public ReporterFactory(string format)
1819
}
1920

2021
public IReporter CreateReporter()
21-
=> _reporters.FirstOrDefault(r => r.Format == _format);
22+
=> _reporters.FirstOrDefault(r => string.Equals(r.Format, _format, StringComparison.OrdinalIgnoreCase));
2223
}
2324
}

src/coverlet.msbuild.tasks/CoverageResultTask.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,19 @@ public override bool Execute()
9090

9191
if (_threshold > 0)
9292
{
93-
if (linePercent < _threshold && thresholdTypes.Contains("line"))
93+
if (linePercent < _threshold && thresholdTypes.Contains("line", StringComparer.OrdinalIgnoreCase))
9494
{
9595
exceptionBuilder.AppendLine($"'{Path.GetFileNameWithoutExtension(module.Key)}' has a line coverage '{linePercent}%' below specified threshold '{_threshold}%'");
9696
thresholdFailed = true;
9797
}
9898

99-
if (branchPercent < _threshold && thresholdTypes.Contains("branch"))
99+
if (branchPercent < _threshold && thresholdTypes.Contains("branch", StringComparer.OrdinalIgnoreCase))
100100
{
101101
exceptionBuilder.AppendLine($"'{Path.GetFileNameWithoutExtension(module.Key)}' has a branch coverage '{branchPercent}%' below specified threshold '{_threshold}%'");
102102
thresholdFailed = true;
103103
}
104104

105-
if (methodPercent < _threshold && thresholdTypes.Contains("method"))
105+
if (methodPercent < _threshold && thresholdTypes.Contains("method", StringComparer.OrdinalIgnoreCase))
106106
{
107107
exceptionBuilder.AppendLine($"'{Path.GetFileNameWithoutExtension(module.Key)}' has a method coverage '{methodPercent}%' below specified threshold '{_threshold}%'");
108108
thresholdFailed = true;

0 commit comments

Comments
 (0)