diff --git a/MinVer.Lib/Versioner.cs b/MinVer.Lib/Versioner.cs index f3e968bb..3f5c20bc 100644 --- a/MinVer.Lib/Versioner.cs +++ b/MinVer.Lib/Versioner.cs @@ -77,7 +77,7 @@ private static (Version Version, int? Height) GetVersion(string workDir, string return (selectedCandidate.Version, selectedCandidate.Height); } - private static List GetCandidates(Commit head, IEnumerable<(string Name, string Sha)> tags, string tagPrefix, List defaultPreReleaseIdentifiers, ILogger log) + private static List GetCandidates(Commit head, IEnumerable<(string Name, string Sha)> tags, string tagPrefix, IReadOnlyCollection defaultPreReleaseIdentifiers, ILogger log) { var tagsAndVersions = new List<(string Name, string Sha, Version Version)>(); @@ -97,7 +97,7 @@ private static List GetCandidates(Commit head, IEnumerable<(string Na [ .. tagsAndVersions .OrderBy(tagAndVersion => tagAndVersion.Version) - .ThenBy(tagsAndVersion => tagsAndVersion.Name) + .ThenBy(tagsAndVersion => tagsAndVersion.Name), ]; var itemsToCheck = new Stack<(Commit Commit, int Height, Commit? Child)>(); diff --git a/MinVer/Logger.cs b/MinVer/Logger.cs index 8fcaf762..1b54b970 100644 --- a/MinVer/Logger.cs +++ b/MinVer/Logger.cs @@ -5,16 +5,14 @@ namespace MinVer; internal sealed class Logger(Verbosity verbosity) : ILogger { - private readonly Verbosity verbosity = verbosity; + public bool IsTraceEnabled => verbosity >= Verbosity.Diagnostic; - public bool IsTraceEnabled => this.verbosity >= Verbosity.Diagnostic; + public bool IsDebugEnabled => verbosity >= Verbosity.Detailed; - public bool IsDebugEnabled => this.verbosity >= Verbosity.Detailed; - - public bool IsInfoEnabled => this.verbosity >= Verbosity.Normal; + public bool IsInfoEnabled => verbosity >= Verbosity.Normal; // warnings are deliberately shown at quiet level - public bool IsWarnEnabled => this.verbosity >= Verbosity.Quiet; + public bool IsWarnEnabled => verbosity >= Verbosity.Quiet; public bool Trace(string message) => this.IsTraceEnabled && Message(message); diff --git a/MinVerTests.Packages/SourceLink.cs b/MinVerTests.Packages/SourceLink.cs index 8c231f7a..fa68bba0 100644 --- a/MinVerTests.Packages/SourceLink.cs +++ b/MinVerTests.Packages/SourceLink.cs @@ -20,7 +20,7 @@ public static async Task HasCommitSha() int.Parse(Sdk.Version.Split(".")[0], NumberStyles.None, CultureInfo.InvariantCulture) < 8) { _ = await Sdk.DotNet( - $"add package Microsoft.SourceLink.GitHub --version 1.1.1 --package-directory packages", path); + "add package Microsoft.SourceLink.GitHub --version 1.1.1 --package-directory packages", path); _ = await Sdk.DotNet("restore --packages packages", path); } diff --git a/minver-cli/Logger.cs b/minver-cli/Logger.cs index b266cae6..149e049f 100644 --- a/minver-cli/Logger.cs +++ b/minver-cli/Logger.cs @@ -5,15 +5,13 @@ namespace MinVer; internal sealed class Logger(Verbosity verbosity) : ILogger { - private readonly Verbosity verbosity = verbosity; + public bool IsTraceEnabled => verbosity >= Verbosity.Trace; - public bool IsTraceEnabled => this.verbosity >= Verbosity.Trace; + public bool IsDebugEnabled => verbosity >= Verbosity.Debug; - public bool IsDebugEnabled => this.verbosity >= Verbosity.Debug; + public bool IsInfoEnabled => verbosity >= Verbosity.Info; - public bool IsInfoEnabled => this.verbosity >= Verbosity.Info; - - public bool IsWarnEnabled => this.verbosity >= Verbosity.Warn; + public bool IsWarnEnabled => verbosity >= Verbosity.Warn; public bool Trace(string message) => this.IsTraceEnabled && Message(message); diff --git a/targets/Program.cs b/targets/Program.cs index 36b5f94f..1e3fdf84 100644 --- a/targets/Program.cs +++ b/targets/Program.cs @@ -20,13 +20,13 @@ "test-lib", "test the MinVer.Lib library", DependsOn("build"), - () => RunAsync("dotnet", ["test", "./MinVerTests.Lib", "--framework", testFx, "--configuration", "Release", "--no-build", "--nologo", .. testLoggerArgs])); + () => RunAsync("dotnet", ["test", "./MinVerTests.Lib", "--framework", testFx, "--configuration", "Release", "--no-build", "--nologo", .. testLoggerArgs,])); Target( "test-packages", "test the MinVer package and the minver-cli console app", DependsOn("build"), - () => RunAsync("dotnet", ["test", "./MinVerTests.Packages", "--configuration", "Release", "--no-build", "--nologo", .. testLoggerArgs])); + () => RunAsync("dotnet", ["test", "./MinVerTests.Packages", "--configuration", "Release", "--no-build", "--nologo", .. testLoggerArgs,])); Target( "eyeball-minver-logs",