From 0f2e2a3ad3b974c9e97e7c947cbfcb20d3637149 Mon Sep 17 00:00:00 2001 From: Mark Ridgwell Date: Sun, 24 Dec 2023 05:08:45 +0000 Subject: [PATCH] [Cleanup] - Code cleanup on FunFair.BuildCheck.sln --- src/FunFair.BuildCheck.Helpers/PathHelpers.cs | 2 +- .../PackableLibrariesShouldNotDependOnNonPackable.cs | 2 +- .../Settings/EnableNetAnalyzersPolicy.cs | 2 +- ...WebConfigDisabledShouldBeTrueForWebLibraryProjects.cs | 1 + src/FunFair.BuildCheck.Runner/CheckRunner.cs | 9 +++++++-- .../FunFair.BuildCheck.Runner.csproj | 2 +- src/FunFair.BuildCheck.Runner/Services/LoggerProxy.cs | 3 ++- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/FunFair.BuildCheck.Helpers/PathHelpers.cs b/src/FunFair.BuildCheck.Helpers/PathHelpers.cs index 6faa6b61..8c4fd8b9 100644 --- a/src/FunFair.BuildCheck.Helpers/PathHelpers.cs +++ b/src/FunFair.BuildCheck.Helpers/PathHelpers.cs @@ -9,6 +9,6 @@ public static string ConvertToNative(string path) return path.Replace(Path.DirectorySeparatorChar == '\\' ? '/' : '\\', - Path.DirectorySeparatorChar); + newChar: Path.DirectorySeparatorChar); } } \ No newline at end of file diff --git a/src/FunFair.BuildCheck.ProjectChecks/References/PackableLibrariesShouldNotDependOnNonPackable.cs b/src/FunFair.BuildCheck.ProjectChecks/References/PackableLibrariesShouldNotDependOnNonPackable.cs index f536983f..5e4c505c 100644 --- a/src/FunFair.BuildCheck.ProjectChecks/References/PackableLibrariesShouldNotDependOnNonPackable.cs +++ b/src/FunFair.BuildCheck.ProjectChecks/References/PackableLibrariesShouldNotDependOnNonPackable.cs @@ -54,7 +54,7 @@ public async ValueTask CheckAsync(string projectName, string projectFolder, XmlD referencedProject = i.FullName; - XmlDocument otherProject = await this._projectXmlLoader.LoadAsync(referencedProject, cancellationToken); + XmlDocument otherProject = await this._projectXmlLoader.LoadAsync(path: referencedProject, cancellationToken: cancellationToken); if (!otherProject.IsPackable()) { diff --git a/src/FunFair.BuildCheck.ProjectChecks/Settings/EnableNetAnalyzersPolicy.cs b/src/FunFair.BuildCheck.ProjectChecks/Settings/EnableNetAnalyzersPolicy.cs index 229afb3e..2a3361e0 100644 --- a/src/FunFair.BuildCheck.ProjectChecks/Settings/EnableNetAnalyzersPolicy.cs +++ b/src/FunFair.BuildCheck.ProjectChecks/Settings/EnableNetAnalyzersPolicy.cs @@ -2,7 +2,7 @@ namespace FunFair.BuildCheck.ProjectChecks.Settings; -public sealed class EnableNetAnalyzersPolicy : SimplePropertyProjectCheckBase +public sealed class EnableNetAnalyzersPolicy : SimplePropertyProjectCheckBase { public EnableNetAnalyzersPolicy(ILogger logger) diff --git a/src/FunFair.BuildCheck.ProjectChecks/Settings/IsTransformWebConfigDisabledShouldBeTrueForWebLibraryProjects.cs b/src/FunFair.BuildCheck.ProjectChecks/Settings/IsTransformWebConfigDisabledShouldBeTrueForWebLibraryProjects.cs index afc8cbdf..6fb978ac 100644 --- a/src/FunFair.BuildCheck.ProjectChecks/Settings/IsTransformWebConfigDisabledShouldBeTrueForWebLibraryProjects.cs +++ b/src/FunFair.BuildCheck.ProjectChecks/Settings/IsTransformWebConfigDisabledShouldBeTrueForWebLibraryProjects.cs @@ -34,6 +34,7 @@ public ValueTask CheckAsync(string projectName, string projectFolder, XmlDocumen } ProjectValueHelpers.CheckValue(projectName: projectName, project: project, nodePresence: "IsTransformWebConfigDisabled", requiredValue: true, logger: this._logger); + return ValueTask.CompletedTask; } } \ No newline at end of file diff --git a/src/FunFair.BuildCheck.Runner/CheckRunner.cs b/src/FunFair.BuildCheck.Runner/CheckRunner.cs index f9b0a265..0c76be84 100644 --- a/src/FunFair.BuildCheck.Runner/CheckRunner.cs +++ b/src/FunFair.BuildCheck.Runner/CheckRunner.cs @@ -89,7 +89,11 @@ private static async ValueTask CheckProjectAsync(SolutionProject project, await TestProjectAsync(projectChecks: projectChecks, project: project, projectFolder: projectFolder, doc: doc, cancellationToken: cancellationToken); } - private static async ValueTask TestProjectAsync(IReadOnlyList projectChecks, SolutionProject project, string projectFolder, XmlDocument doc, CancellationToken cancellationToken) + private static async ValueTask TestProjectAsync(IReadOnlyList projectChecks, + SolutionProject project, + string projectFolder, + XmlDocument doc, + CancellationToken cancellationToken) { foreach (IProjectCheck check in projectChecks) { @@ -117,7 +121,8 @@ private static IServiceProvider Setup(bool warningsAsErrors, .AddSingleton() .SetupSolutionChecks() .SetupProjectChecks(repositorySettings: wrappedRepositorySettings) - .AddSingleton(new CheckConfiguration(preReleaseBuild: preReleaseBuild, allowPackageVersionMismatch: false))); + .AddSingleton( + new CheckConfiguration(preReleaseBuild: preReleaseBuild, allowPackageVersionMismatch: false))); } private static async ValueTask> LoadProjectsAsync(string solution, CancellationToken cancellationToken) diff --git a/src/FunFair.BuildCheck.Runner/FunFair.BuildCheck.Runner.csproj b/src/FunFair.BuildCheck.Runner/FunFair.BuildCheck.Runner.csproj index c9a59a05..29fc3706 100644 --- a/src/FunFair.BuildCheck.Runner/FunFair.BuildCheck.Runner.csproj +++ b/src/FunFair.BuildCheck.Runner/FunFair.BuildCheck.Runner.csproj @@ -56,9 +56,9 @@ + - diff --git a/src/FunFair.BuildCheck.Runner/Services/LoggerProxy.cs b/src/FunFair.BuildCheck.Runner/Services/LoggerProxy.cs index a0d42cbf..3a75dd29 100644 --- a/src/FunFair.BuildCheck.Runner/Services/LoggerProxy.cs +++ b/src/FunFair.BuildCheck.Runner/Services/LoggerProxy.cs @@ -8,7 +8,8 @@ public sealed class LoggerProxy : ILogger { private readonly ILogger _diagnosticLogger; - public LoggerProxy([SuppressMessage(category: "FunFair.CodeAnalysis", checkId: "FFS0024: Logger parameters should be ILogger", Justification = "Not created through DI")] ILogger logger) + public LoggerProxy( + [SuppressMessage(category: "FunFair.CodeAnalysis", checkId: "FFS0024: Logger parameters should be ILogger", Justification = "Not created through DI")] ILogger logger) { this._diagnosticLogger = logger; }