diff --git a/starsky/build/Build.cs b/starsky/build/Build.cs index 6ba7f2bb53..3a4c74ce55 100644 --- a/starsky/build/Build.cs +++ b/starsky/build/Build.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using helpers; using Nuke.Common; @@ -10,14 +11,17 @@ // ReSharper disable once CheckNamespace namespace build; -[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", +[SuppressMessage("Usage", "S3887:Use an immutable collection or reduce the " + "accessibility of the non-private readonly field", Justification = "Not production code.")] -[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", +[SuppressMessage("Usage", "S2386:Use an immutable collection or reduce " + "the accessibility of the non-private readonly field", Justification = "Not production code.")] +[SuppressMessage("Sonar", + "S2629: Don't use string interpolation in logging message templates", + Justification = "Not production code.")] [ShutdownDotNetAfterServerBuild] public sealed class Build : NukeBuild { @@ -64,7 +68,7 @@ public sealed class Build : NukeBuild /// Nuget & NPM dependencies are always installed /// [Parameter("Skip Dependencies download e.g. exiftool / " + - "geo data, nuget/npm deps are always installed")] + "geo data, nuget/npm deps are always installed")] readonly bool NoDependencies; /// @@ -104,7 +108,7 @@ string GetBranchName() { var branchName = Branch; if ( !string.IsNullOrEmpty(branchName) && - branchName.StartsWith("refs/heads/") ) + branchName.StartsWith("refs/heads/") ) { branchName = branchName.Replace("refs/heads/", ""); } @@ -126,7 +130,7 @@ string GetBranchName() /// --ready-to-run /// /// - public bool IsReadyToRunEnabled() + bool IsReadyToRunEnabled() { return ReadyToRun; } @@ -236,7 +240,7 @@ void ShowSettingsInfo() $"Current RID: {RuntimeIdentifier.GetCurrentRuntimeIdentifier()}"); Log.Information("SolutionParentFolder: " + - WorkingDirectory.GetSolutionParentFolder()); + WorkingDirectory.GetSolutionParentFolder()); Log.Information(NoClient ? "Client is: disabled" @@ -251,8 +255,8 @@ void ShowSettingsInfo() : "Publish: enabled"); Log.Information(NoSonar || - string.IsNullOrEmpty(SonarQube.GetSonarKey()) || - string.IsNullOrEmpty(SonarQube.GetSonarToken()) + string.IsNullOrEmpty(SonarQube.GetSonarKey()) || + string.IsNullOrEmpty(SonarQube.GetSonarToken()) ? "Sonarcloud scan: disabled" : "Sonarcloud scan: enabled"); @@ -319,7 +323,7 @@ void ShowSettingsInfo() IsPublishDisabled()); }); - [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", + [SuppressMessage("Usage", "S1144:UnusedMember.Local", Justification = "Not production code.")] // ReSharper disable once UnusedMember.Local Target DownloadDependencies => p => p @@ -370,7 +374,7 @@ void ShowSettingsInfo() }); // ReSharper disable once UnusedMember.Local - [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", + [SuppressMessage("Usage", "S1144:UnusedMember.Local", Justification = "Not production code.")] Target BuildNetCore => p => p .Executes(() => @@ -383,7 +387,7 @@ void ShowSettingsInfo() }); // ReSharper disable once UnusedMember.Local - [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", + [SuppressMessage("Usage", "S1144:UnusedMember.Local", Justification = "Not production code.")] Target TestNetCore => p => p .Executes(() => diff --git a/starsky/build/helpers/DotnetGenericHelper.cs b/starsky/build/helpers/DotnetGenericHelper.cs index c85772efa7..9cc4a5a85f 100644 --- a/starsky/build/helpers/DotnetGenericHelper.cs +++ b/starsky/build/helpers/DotnetGenericHelper.cs @@ -17,7 +17,7 @@ public static class DotnetGenericHelper /// solution file .sln public static void RestoreNetCoreCommand(Solution solution) { - Log.Information("dotnet restore: solution: {solution}", solution); + Log.Information("dotnet restore: solution: {Solution}", solution); DotNetRestore(p => p .SetProjectFile(solution.Path) @@ -64,7 +64,7 @@ public static void DownloadDependencies(Configuration configuration, { Environment.SetEnvironmentVariable("app__DependenciesFolder", genericDepsFullPath); Log.Information("Next: DownloadDependencies"); - Log.Information("Run: " + Path.Combine( + Log.Information("Run: {Path}", Path.Combine( WorkingDirectory.GetSolutionParentFolder(), geoCliCsproj) ); diff --git a/starsky/build/helpers/HttpQuery.cs b/starsky/build/helpers/HttpQuery.cs index 7bb478d542..69a34a6fc3 100644 --- a/starsky/build/helpers/HttpQuery.cs +++ b/starsky/build/helpers/HttpQuery.cs @@ -26,7 +26,8 @@ public static class HttpQuery } catch ( HttpRequestException exception ) { - Log.Information($"GetJsonFromApi {exception.StatusCode} {exception.Message}"); + Log.Information("GetJsonFromApi {StatusCode} {Message}", exception.StatusCode, + exception.Message); return null; } } diff --git a/starsky/build/helpers/RuntimeIdentifier.cs b/starsky/build/helpers/RuntimeIdentifier.cs index 32f469a8fc..130ed62386 100644 --- a/starsky/build/helpers/RuntimeIdentifier.cs +++ b/starsky/build/helpers/RuntimeIdentifier.cs @@ -46,7 +46,7 @@ static bool IsReadyToRunSupported(string currentIdentifier, string toRuntimeIden } // Handle unsupported currentIdentifier - Log.Error("Unsupported currentIdentifier: {currentIdentifier}", currentIdentifier); + Log.Error("Unsupported currentIdentifier: {CurrentIdentifier}", currentIdentifier); return false; } } diff --git a/starsky/build/helpers/TrxParserHelper.cs b/starsky/build/helpers/TrxParserHelper.cs index 2bf89047bc..b82af9991d 100644 --- a/starsky/build/helpers/TrxParserHelper.cs +++ b/starsky/build/helpers/TrxParserHelper.cs @@ -72,9 +72,9 @@ public static void DisplayFileTests(string trxFullFilePath) foreach ( var result in results ) { - Log.Error($"Test Name: {result.Item1}"); - Log.Error($"Message: {result.Item2}"); - Log.Error($"Stack Trace: {result.Item3}"); + Log.Error("Test Name: {TestName}", result.Item1); + Log.Error("Message: {Message}", result.Item2); + Log.Error("Stack Trace: {StackTrace}", result.Item3); Log.Information("------------------------"); } }