Skip to content

Commit

Permalink
Fixed code analysis issues
Browse files Browse the repository at this point in the history
  • Loading branch information
credfeto committed Nov 15, 2023
1 parent 2f33043 commit bc5bf12
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/Credfeto.ChangeLog.Tests/AssemblySettings.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
using System.Diagnostics.CodeAnalysis;

[assembly:
SuppressMessage(category: "Philips.CodeAnalysis.MaintainabilityAnalyzers",
checkId: "PH2140: Avoid ExcludeFromCodeCoverage",
Justification = "This is a unit test assembly - no need for coverage of the test code itself")]
[assembly: ExcludeFromCodeCoverage]
6 changes: 3 additions & 3 deletions src/Credfeto.ChangeLog/ChangeLogReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ private static bool IsMatchingVersion(Version? version, string line)
return StringComparer.InvariantCultureIgnoreCase.Equals(x: line, y: Constants.UnreleasedHeader);
}

return Candidates(version)
.Any(candidate => line.StartsWith(value: candidate, comparisonType: StringComparison.OrdinalIgnoreCase));

static IEnumerable<string> Candidates(Version expected)
{
int build = expected.Build is 0 or -1
Expand All @@ -141,8 +144,5 @@ static IEnumerable<string> Candidates(Version expected)
yield return $"## [{expected.Major}.{expected.Minor}]";
}
}

return Candidates(version)
.Any(candidate => line.StartsWith(value: candidate, comparisonType: StringComparison.OrdinalIgnoreCase));
}
}

0 comments on commit bc5bf12

Please sign in to comment.