Skip to content

fix: resolve remaining SonarCloud assertion and VB template findings - #5320

Merged
arturcic merged 2 commits into
GitTools:mainfrom
arturcic:codex/sonar-generator-assertion-suppression
Oct 14, 2026
Merged

arturcic merged 2 commits into
GitTools:mainfrom
arturcic:codex/sonar-generator-assertion-suppression

Conversation

@arturcic

@arturcic arturcic commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Resolve the two remaining SonarCloud false positives using configuration appropriate to each finding.

  • Replace ineffective NOSONAR on ValidateGeneratedCommandImplementation with pragma warning disable/restore S2699 scoped to that method. The generator harness still verifies diagnostics and four generated sources; Sonar's metrics collector skips NOSONAR metadata for test projects.
  • Exclude the four embedded VB generation templates/fragments through .sonarcloud.properties. Automatic analysis otherwise builds a synthetic orphan VB project and reports compilation-level vbnet:S6145 without a source location, which cannot be suppressed by a source pragma.

Preserve the existing Addins exclusion with its nine current literal paths. Automatic-analysis documentation disallows wildcard patterns in this configuration, so future Addins files must be added to the list. Templates remain embedded resources and generated output is unchanged.

Validation: the focused generator test passed; configuration validation confirms 13 unique tracked paths, exactly all four VB templates and nine previously excluded Addins files; git diff origin/main --check passes. Combined local CodeRabbit review completed at a9be758 with zero findings across both changed files. An earlier wildcard suggestion on the standalone configuration was dismissed based on the official documentation.

Supersedes #5321 by folding its configuration commit into this PR.

References: Automatic analysis configuration, S6145 compilation-level implementation.

Monitor CI and SonarCloud for the current head. Confirm historical issue keys AZh_4UdBS70vPb2ZqA9o (S2699) and AZh_4UdhS70vPb2ZqA9r (synthetic VB S6145) are CLOSED/FIXED or absent from the active false-positive inventory only after completed main analysis includes the merge. A clean PR analysis does not prove their removal.

Copilot AI balanced review requested due to automatic review settings October 14, 2026 12:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b7cc82e9-b432-4591-a8c7-fdad74ddd33f
📥 Commits

Reviewing files that changed from the base of the PR and between a9be758 and d3f03d5.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6876c611-a9a8-4598-9ff2-f247673597d4
📥 Commits

Reviewing files that changed from the base of the PR and between 336de44 and a9be758.

📒 Files selected for processing: 1
  • .sonarcloud.properties

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

📝 Walkthrough

The test now suppresses Sonar rule S2699 around ValidateGeneratedCommandImplementation and restores the warning afterward. The method-level NOSONAR comment was removed. Test setup and generated-source validation are unchanged.

Changes: Test warning suppression

Layer / File(s) Summary
Scope S2699 suppression
new-cli/GitVersion.Cli.Generator.Tests/SystemCommandlineGeneratorTests.cs
The test suppresses S2699 before the method and restores the warning after it. The method-level NOSONAR comment was removed.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to a9be7

The change limits Sonar exclusions to the intended files and keeps the generator test’s existing expectations with a scoped suppression. No concrete issue prevents merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes both main changes: resolving the remaining SonarCloud assertion finding and addressing findings in the VB templates.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@arturcic
arturcic force-pushed the codex/sonar-generator-assertion-suppression branch from 704bf11 to 336de44 Compare October 14, 2026 12:20
@arturcic arturcic changed the title fix: suppress generator assertion false positive at analyzer level fix: resolve remaining SonarCloud assertion and VB template findings Oct 14, 2026
@arturcic
arturcic force-pushed the codex/sonar-generator-assertion-suppression branch from a9be758 to d3f03d5 Compare October 14, 2026 13:20
@sonarqubecloud

Copy link
Copy Markdown

@arturcic
arturcic merged commit 80cbc2e into GitTools:main Oct 14, 2026
62 of 63 checks passed
@arturcic
arturcic deleted the codex/sonar-generator-assertion-suppression branch October 14, 2026 13:56
@mergify

mergify Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Thank you @arturcic for your contribution!

This was referenced Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants