From a6f7fac9678d0a392155f9d847ff4d7c48de0465 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Wed, 14 Oct 2026 14:17:01 +0200 Subject: [PATCH 1/2] fix: suppress generator assertion false positive at analyzer level --- .../SystemCommandlineGeneratorTests.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/new-cli/GitVersion.Cli.Generator.Tests/SystemCommandlineGeneratorTests.cs b/new-cli/GitVersion.Cli.Generator.Tests/SystemCommandlineGeneratorTests.cs index b1ee8ba7d2..e13f4f1e54 100644 --- a/new-cli/GitVersion.Cli.Generator.Tests/SystemCommandlineGeneratorTests.cs +++ b/new-cli/GitVersion.Cli.Generator.Tests/SystemCommandlineGeneratorTests.cs @@ -232,8 +232,9 @@ public record TestCommandSettings : GitVersionSettings """; +#pragma warning disable S2699 // RunAsync verifies diagnostics and all expected generated sources; Sonar does not collect NOSONAR lines for test projects. [Test] - public async Task ValidateGeneratedCommandImplementation() // NOSONAR: RunAsync verifies diagnostics and all expected generated sources. + public async Task ValidateGeneratedCommandImplementation() { var generatorType = typeof(SystemCommandlineGenerator); var encoding = Encoding.UTF8; @@ -288,4 +289,5 @@ public async Task ValidateGeneratedCommandImplementation() // NOSONAR: RunAsync }); await sourceGeneratorTest.RunAsync(); } +#pragma warning restore S2699 } From d3f03d5d2a4ea04e3624233ec6654fccffd48e28 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Wed, 14 Oct 2026 14:34:49 +0200 Subject: [PATCH 2/2] chore: exclude VB generation templates from Sonar automatic analysis --- .sonarcloud.properties | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .sonarcloud.properties diff --git a/.sonarcloud.properties b/.sonarcloud.properties new file mode 100644 index 0000000000..b5f0603c61 --- /dev/null +++ b/.sonarcloud.properties @@ -0,0 +1,21 @@ +# Automatic analysis reads this file instead of sonar-project.properties. +# Use literal paths: wildcard patterns are not supported by automatic analysis. +# Preserve the files covered by the existing build/common/Addins/**/* exclusion. +# Add new vendored addin files here to retain that exclusion as the directory grows. +sonar.exclusions=\ + build/common/Addins/Cake.Docker/DockerBuildXBuildSettings.cs,\ + build/common/Addins/Cake.Docker/DockerBuildXImageToolsCreateSettings.cs,\ + build/common/Addins/Cake.Docker/Constants.cs,\ + build/common/Addins/GitVersion/GitVersionVerbosity.cs,\ + build/common/Addins/GitVersion/GitVersion.cs,\ + build/common/Addins/GitVersion/GitVersionAliases.cs,\ + build/common/Addins/GitVersion/GitVersionOutput.cs,\ + build/common/Addins/GitVersion/GitVersionSettings.cs,\ + build/common/Addins/GitVersion/GitVersionRunner.cs,\ + src/GitVersion.Output/GitVersionInfo/Templates/GitVersionInformation.vb,\ + src/GitVersion.Output/GitVersionInfo/AddFormats/GitVersionInformation.vb,\ + src/GitVersion.Output/AssemblyInfo/Templates/VersionAssemblyInfo.vb,\ + src/GitVersion.Output/AssemblyInfo/AddFormats/VersionAssemblyInfo.vb + +# The VB files are embedded generation templates/fragments, not a VB project. +# Excluding them avoids the synthetic orphan-project S6145 finding.