Skip to content

Address the SonarCloud findings from #57 - #58

Merged
matt-edmondson merged 1 commit into
mainfrom
claude/bold-planck-mxarux
Sep 12, 2026
Merged

Address the SonarCloud findings from #57#58
matt-edmondson merged 1 commit into
mainfrom
claude/bold-planck-mxarux

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Follow-up to #57, which merged before these landed. SonarCloud's quality gate passed there, so nothing blocked the merge — but its comment reported 24 new issues without naming them, and all 24 are in code that is now on main.

Its dashboard is reachable from the agent sandbox, so these came from the API rather than from guessing.

The one that is a real defect

S2699, reported as a blocker, was right. WhatThePaletteCreates_IsReadyToConnect reads every slot of every new node and asserts nothing about what comes back — the body is a bare call with a comment saying it must not throw.

It is worse than an empty assertion, too: it has no guard against its own filter matching nothing, so it would pass just as happily if the palette stopped offering these nodes entirely. That is precisely the regression it exists to catch.

It now asserts that all three templates are found, and that every operand already sitting in a slot is the placeholder the rest of the library understands rather than a null it does not.

The rest, and where I declined one

S1192 (7) — constants where a literal repeats. AstSchema already keeps one for the arguments slot's name, so the new slot names follow it; the palette's category names and the serializer's expectedType key follow the conventions their own files already set (ValueKey, MembersKey).

MSTest analyzers (14) — the assertions that say what they mean: HasCount over AreEqual on a count, IsEmpty over AreEqual against zero, AreSequenceEqual over CollectionAssert, and Contains over IsTrue wrapped around a predicate. I checked each is already established in this suite before adopting it — 22, 4 and 10 existing call sites respectively — so these match the surrounding code rather than introducing a second style.

MSTEST0046 (2) — declined, deliberately. It prefers Assert.Contains over StringAssert.Contains. This suite calls StringAssert.Contains in 188 places, including tests merged from #56 the same day, and has no bare Assert.Contains anywhere in it. Two call sites written the other way would read as a mistake rather than as an improvement. Worth changing repo-wide or not at all, and that is a separate decision from this PR.

Verification

  • dotnet build and dotnet build -c Release — clean, 0 warnings, both target frameworks
  • Full suite: 630 passed, 0 failed
  • No suppressions added

🤖 Generated with Claude Code

https://claude.ai/code/session_01QGCMUrT3jBgmANHNHcPmBf


Generated by Claude Code

The quality gate passed on #57 and it merged before these landed, so all 24
findings are in code that is now on main. One of them is a real defect rather
than a style note.

S2699, reported as a blocker, was right: WhatThePaletteCreates_IsReadyToConnect
reads every slot of every new node and asserts nothing about what comes back.
It also has no guard against its own filter matching nothing, so it would pass
just as happily if the palette stopped offering these nodes entirely — which is
the regression it exists to catch. It now asserts that all three templates are
found, and that every operand already sitting in a slot is the placeholder the
rest of the library understands rather than a null it does not.

S1192 asked for constants where a literal repeats. AstSchema already keeps one
for the arguments slot's name and the new slots now have theirs; the palette's
category names and the serializer's expectedType key follow the same
convention their own files already set.

The MSTest analyzers asked for the assertions that say what they mean:
HasCount over AreEqual on a count, IsEmpty over AreEqual against zero,
AreSequenceEqual over CollectionAssert, and Contains over IsTrue around a
predicate. All four are already used elsewhere in this suite, so these match
the surrounding code rather than introducing a second style.

MSTEST0046 is left as it was, and that is the one deliberate exception. It
prefers Assert.Contains over StringAssert.Contains, but this suite calls
StringAssert.Contains in 188 places and has no bare Assert.Contains anywhere.
Two call sites written the other way would read as a mistake rather than as an
improvement.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QGCMUrT3jBgmANHNHcPmBf
@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 9acfa5e into main Sep 12, 2026
12 checks passed
@matt-edmondson
matt-edmondson deleted the claude/bold-planck-mxarux branch September 12, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants