Skip to content

S3267: clear the last two generator loops - #166

Merged
matt-edmondson merged 1 commit into
mainfrom
chore/sonar-select-loops
Aug 14, 2026
Merged

S3267: clear the last two generator loops#166
matt-edmondson merged 1 commit into
mainfrom
chore/sonar-select-loops

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

S3267 is now clean in Semantics.SourceGenerators.

  • DimensionsMetadata inspected only overload.Name inside its validation loop, so it now iterates Select(overload => overload.Name) directly and the body reads against a string rather than reaching through the object each time.
  • DimensionsGenerator built one marker-interface ClassTemplate per dimension and added them one at a time; now Classes.AddRange(sortedDimensions.Select(...)).

Verification

  • Local Sonar check — S3267 in Semantics.SourceGenerators: 4 → 0
  • dotnet build — 0 errors, 0 warnings, all target frameworks
  • dotnet test1095/1095 pass
  • No generated-file drift

Remaining — ~24

S3776 ×6 is now the only rule left in the generator project, and the only one the local check still reports there. The rest sit outside it: S4136 ×8 in SemanticString.cs, S1133 ×10, S2342 ×2, S4144 ×1.

As flagged on #165, two of those want a decision rather than a fix — S1133 means deleting [Obsolete] public API, and S2342 means renaming public enums for a naming convention. Both are better triaged as Accepted in SonarCloud than changed unilaterally.

S3267 is now clean in Semantics.SourceGenerators.

- DimensionsMetadata inspected only overload.Name inside its validation
  loop, so it now iterates Select(overload => overload.Name) directly.
- DimensionsGenerator built one marker-interface ClassTemplate per dimension
  and added them one at a time; now Classes.AddRange(sortedDimensions.Select(...)).

Verified with the local check: S3267 4 -> 0. Generated output byte-identical,
no drift. Build clean on all TFMs, 1095/1095 tests pass.
@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 0b84eff into main Aug 14, 2026
6 checks passed
@matt-edmondson
matt-edmondson deleted the chore/sonar-select-loops branch August 14, 2026 12:02
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.

1 participant