Address the SonarCloud findings from #219 - #220
Merged
Merged
Conversation
Six, all in code #219 added, and none of them arguable once the repository's own conventions are checked rather than assumed. The gate passed there and it merged before these landed. Four are MSTest analyzer findings on the new test, and this repository wants exactly what they ask for: Assert.Contains has 105 call sites in Semantics.Test and StringAssert.Contains had two, both of them from that PR; Assert.DoesNotContain has ten. Worth noting because the same rule went the other way in ktsu.Coder, where StringAssert.Contains has 188 call sites and the bare form has none -- the rule is the same and the right answer is the opposite, which is why the count is worth taking before the suggestion is. DoesNotContain takes an expected value and a collection rather than a collection and a predicate, so the two assertions project the refusals to their kinds first, which reads more directly than the IsFalse-around-Any they replace. The other two are S3358, nested ternaries in the vocabulary, at major severity. Both predate the lift and moved with the file, which is why they are counted as new code; both are now named methods -- how far down an overload is bounded, and which forms a relationship asks for -- with the reasoning that was implicit in the nesting written out. Behaviour is unchanged: 1136 and 27 tests pass, and the generated output is still byte-identical. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QGCMUrT3jBgmANHNHcPmBf
|
This was referenced Sep 14, 2026
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.



Follow-up to #219, which merged before these landed. The quality gate passed there, so nothing blocked the merge — but six new issues were reported without being named, and all six are in code that PR added.
Its dashboard is reachable from the agent sandbox, so these came from the API rather than from guessing.
Four MSTest findings, and why the count mattered
MSTEST0046wantedAssert.ContainsoverStringAssert.Contains, andMSTEST0037wantedAssert.DoesNotContainoverAssert.IsFalse(… .Any(…)).This repository wants exactly that.
Semantics.Testhas 105Assert.Containscall sites and had twoStringAssert.Contains— both from #219 — plus 10 existingAssert.DoesNotContain. So the new test was the outlier, and these changes move it onto the surrounding convention.Worth recording why that was checked rather than assumed: the identical rule went the other way in
ktsu.Coderearlier today, whereStringAssert.Containshas 188 call sites and the bare form has none, so the right answer there was to decline it. Same rule, opposite conclusion, decided by counting.DoesNotContaintakes an expected value and a collection rather than a collection and a predicate, so both assertions now project the refusals to their kinds first — which reads more directly than theIsFalse-around-Anyit replaces:Two nested ternaries, at major severity
S3358onQuantityVocabulary.cs. Both predate the lift and moved with the file, which is why Sonar counts them as new code — and both are worth extracting on their own merits, since each was a physics rule compressed into nesting.They are now named methods with the reasoning written out:
BoundOf(only the magnitude form is bounded below at all, so a stricter floor on an overload applies there and nowhere else) andWanted(a cross product defaults to three components because that is where a cross product exists; everything else defaults to every form).Verification
dotnet buildanddotnet build -c Release— clean, 0 warningsSemantics.Test: 1136 tests, 0 failedSemantics.Cpp.Test: 27 passed, including theg++/clang++compile testsSemantics.Quantities/Generated/🤖 Generated with Claude Code
https://claude.ai/code/session_01QGCMUrT3jBgmANHNHcPmBf
Generated by Claude Code