refactor(lib-core): use a collection expression in SlnParser - #196
Merged
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
🟢 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 inSlnParser.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.
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.
Summary
Fixes the only open SonarQube issue on
develop, which was failing the quality gate (new_violations= 1, threshold 0).external_roslyn:IDE0305: collection initialization can be simplifiedsrc/ProjGraph.Lib.Core/Parsers/SlnParser.cs:70.ToList()inGetProjectPathswith 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🤖 Generated with Claude Code