Close the local SonarCloud calibration gap (S8969) - #106
Merged
Merged
Conversation
The local reproduction reported five S2699 and missed the sixth issue
SonarCloud reports. That issue is S8969 ("Null-forgiving operators should
not be redundant") on DocComment.cs:191, where the string.IsNullOrEmpty
guard directly above already makes the `text!` redundant.
Adding a severity line alone would not have surfaced it. S8969 ships
disabled by default AND was absent from the pinned SonarAnalyzer.CSharp
10.18.0.131500, so the rule could not fire at all. 10.30.0.144632 is its
first release, so the pin moves there and the severity line goes in.
The local set now matches SonarCloud exactly, by file and line:
5x S2699 in CodeBlocker.Test plus S8969 on DocComment.cs:191.
Records the calibration query against the public SonarCloud API so the
comparison is repeatable, and notes that a rule which stays silent after
being listed is a package-version problem rather than a severity one.
Nothing imports these files automatically: a plain `dotnet build` still
reports no Sonar diagnostics and `dotnet test` passes 171/171.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FUReBqNhW1FferSYkYG9Gd
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #88
What was left
The
.sonarlint/local reproduction already landed and works. The one acceptance criterion stillopen was that its output match what SonarCloud reports for the same commit — it reported five
S2699and missed a sixth issue that the previous attempt recorded as an unidentified gap, becausesonarcloud.io was unreachable from the sandbox at the time. It is reachable now, and the project is
public, so the dashboard could be read directly.
The missing issue
S8969— "Null-forgiving operators should not be redundant" — onCodeBlocker/Templates/DocComment.cs:191:Why the severity line alone would not have worked
This is the part worth recording, because the previous note assumed the fix was a missing
severity entry. It was not, on its own.
S8969is both shipped disabled by default andabsent from the pinned
SonarAnalyzer.CSharp10.18.0.131500— a rule the package does not carrycannot fire however it is configured. I bisected the releases:
10.30.0.144632is the first onecontaining it, so the pin moves there (the smallest bump that works) and the severity line goes in
alongside.
That failure mode is now documented in both the globalconfig and
CLAUDE.md: a rule that stayssilent locally after being listed is a package-version problem, not a severity problem.
Verification
Local run and SonarCloud now agree exactly, by file and line:
S2699CodeBlocker.Test/CodeBlockerTests.cs:115S2699CodeBlocker.Test/CodeBlockerTests.cs:128S2699CodeBlocker.Test/CodeBlockerTests.cs:398S2699CodeBlocker.Test/ScopeTests.cs:98S2699CodeBlocker.Test/ScopeWithTrailingSemicolonTests.cs:98S8969CodeBlocker/Templates/DocComment.cs:191Before/after on the same tree confirms the change is what surfaces it: on
mainthe same commandreports only the five
S2699; with this branch it reports all six.Against the issue's acceptance criteria:
issue from Generalize CodeBlocker into a code-generation substrate #87
dotnet buildreports 0 Sonardiagnostics, and
dotnet testpasses 171/171Scope
Calibration only. The
S8969finding itself is now visible locally but is deliberately leftunfixed — this PR is about making the reproduction faithful, not about changing library code, and
the finding is useful as live evidence that the two sides agree. Worth a follow-up to drop the
redundant
!.The repo's
.gitignorehad an unrelated local modification during this session; it is not part ofthis branch.
🤖 Generated with Claude Code
https://claude.ai/code/session_01FUReBqNhW1FferSYkYG9Gd
Generated by Claude Code