Skip to content

refactor(lib-core): use a collection expression in SlnParser - #196

Merged
HandyS11 merged 1 commit into
developfrom
fix/sonar-ide0305-sln-parser
Sep 15, 2026
Merged

HandyS11 merged 1 commit into
developfrom
fix/sonar-ide0305-sln-parser

Conversation

@HandyS11

Copy link
Copy Markdown
Owner

Summary

Fixes the only open SonarQube issue on develop, which was failing the quality gate (new_violations = 1, threshold 0).

  • Rule: external_roslyn:IDE0305: collection initialization can be simplified
  • Location: src/ProjGraph.Lib.Core/Parsers/SlnParser.cs:70
  • Change: replaced the trailing .ToList() in GetProjectPaths with a [.. ] collection expression. This matches how the EF library already writes it (EntityFileDiscovery, DiscoverContextsUseCase).

The rest of the quality gate was already passing: new coverage 94.5%, new duplication 0.0%, no security hotspots to review.

Test plan

  • dotnet build ProjGraph.slnx (warnings as errors, code style enforced)
  • dotnet test ProjGraph.slnx: 1181 passed
  • SonarQube analysis on this PR shows 0 new issues

🤖 Generated with Claude Code

Resolves the SonarQube IDE0305 finding ("Collection initialization can be
simplified") that was failing the quality gate's new_violations condition.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 15, 2026 12:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is a small, localized refactor that preserves the public API and behavior while addressing the stated analyzer issue.

Pull request overview

Refactors SlnParser.GetProjectPaths to address a SonarQube/style issue by using a C# collection expression instead of a trailing .ToList(), keeping the method behavior as an eagerly-materialized collection returned as IEnumerable<string>.

Changes:

  • Replaced LINQ .ToList() materialization with a [..] collection expression in SlnParser.GetProjectPaths.
  • Preserved the existing filtering and path normalization logic while keeping the return type (IEnumerable<string>) unchanged.
File summaries
File Description
src/ProjGraph.Lib.Core/Parsers/SlnParser.cs Uses a collection expression to materialize project paths instead of calling .ToList(), satisfying IDE0305.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@HandyS11
HandyS11 merged commit 5f63979 into develop Sep 15, 2026
8 checks passed
@HandyS11
HandyS11 deleted the fix/sonar-ide0305-sln-parser branch September 15, 2026 14:41
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