chore(sonar): clear residual 24 test-file smells #17

Merged
bermudalamb merged 1 commits from fix/sonarqube-tests-residual into main 2026-05-27 15:36:38 -05:00
Owner

Summary

Drives the SonarQube tests/ open-issue count from 24 → 0. Non-breaking. Single commit.

Group Count Fix
NUnit2046 15 Extend the prior regex sweep to catch Is.GreaterThan(n) / Is.GreaterThanOrEqualTo(n) variants on .Count and .Length — the previous pass only handled Is.EqualTo
CS8604 8 merged[someKey] inside Assert.Multiple lambdas where someKey is string? from FirstOrDefault. The Assert.That(someKey, Is.Not.Null) immediately above does not propagate null-narrowing into the lambda scope, so the dictionary access gets !
NUnit2045 1 Wrap a four-assert block in JsonTokenReaderTests.cs:65-68 in Assert.Multiple, matching the surrounding two Assert.Multiple groups in that test

All 1180 tests stay green. Build clean (0 errors, pre-existing warnings unchanged).

Test plan

  • dotnet build Strata.SqlTools.QueryBreakdown.sln -c Release — 0 errors
  • dotnet test ... -c Release --no-build — 1180 passed, 0 failed
  • Gitea Actions sonarqube.yml runs on this PR
  • Re-query /api/issues/search?componentKeys=sql-utilities&resolved=false&facets=rules — open issue count should drop from 24 → 0
## Summary Drives the SonarQube `tests/` open-issue count from **24 → 0**. Non-breaking. Single commit. | Group | Count | Fix | |---|--:|---| | `NUnit2046` | 15 | Extend the prior regex sweep to catch `Is.GreaterThan(n)` / `Is.GreaterThanOrEqualTo(n)` variants on `.Count` and `.Length` — the previous pass only handled `Is.EqualTo` | | `CS8604` | 8 | `merged[someKey]` inside `Assert.Multiple` lambdas where `someKey` is `string?` from `FirstOrDefault`. The `Assert.That(someKey, Is.Not.Null)` immediately above does not propagate null-narrowing into the lambda scope, so the dictionary access gets `!` | | `NUnit2045` | 1 | Wrap a four-assert block in `JsonTokenReaderTests.cs:65-68` in `Assert.Multiple`, matching the surrounding two `Assert.Multiple` groups in that test | All 1180 tests stay green. Build clean (0 errors, pre-existing warnings unchanged). ## Test plan - [x] `dotnet build Strata.SqlTools.QueryBreakdown.sln -c Release` — 0 errors - [x] `dotnet test ... -c Release --no-build` — 1180 passed, 0 failed - [ ] Gitea Actions `sonarqube.yml` runs on this PR - [ ] Re-query `/api/issues/search?componentKeys=sql-utilities&resolved=false&facets=rules` — open issue count should drop from 24 → 0
bermudalamb added 1 commit 2026-05-27 15:29:55 -05:00
chore(sonar): clear residual test-file smells (NUnit2046, NUnit2045, CS8604)
SonarQube Analysis / sonarqube (pull_request) Successful in 3m41s
f55d8130e6
- **NUnit2046 (15)**: extend the prior regex sweep to also catch the
  `Is.GreaterThan(n)` / `Is.GreaterThanOrEqualTo(n)` variants on
  `.Count` and `.Length` — the previous pass only handled `Is.EqualTo`.
  Affects PG/Snowflake `QueryBreakdownTests`, PG `StatementReaderTests`,
  `LinqToSql` `QueryComparatorTests` / `QueryValidatorTests`,
  `Markdown.Tests` `ExpressionGeneratorTests` /
  `QueryBreakdownGeneratorTests`, and `JsonTokenReaderTests`.

- **CS8604 (8)**: `merged[someKey]` access inside `Assert.Multiple(() =>
  { ... })` lambdas where `someKey` is `string?` from `FirstOrDefault`.
  The preceding `Assert.That(someKey, Is.Not.Null)` does not propagate
  null-narrowing into the lambda scope, so add `!` to the dictionary
  index. (Tests fail loud with a meaningful message if the key really
  is null, so this is safe.)

- **NUnit2045 (1)**: wrap a four-assert block in
  `JsonTokenReaderTests.cs:65-68` in `Assert.Multiple`. Mirrors the
  surrounding two `Assert.Multiple` groups in that method.

All 1180 tests stay green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bermudalamb merged commit d95795cc25 into main 2026-05-27 15:36:38 -05:00
bermudalamb deleted branch fix/sonarqube-tests-residual 2026-05-27 15:36:39 -05:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Lambda-Associates/sql-utilities#17