Fix SonarQube and CodeQL code quality issues#156
Merged
Malcolmnixon merged 5 commits intomainfrom Apr 11, 2026
Merged
Conversation
Agent-Logs-Url: https://github.com/demaconsulting/BuildMark/sessions/be28171f-0525-4483-8269-73c2511bf8a3 Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Agent-Logs-Url: https://github.com/demaconsulting/BuildMark/sessions/1faac23d-63db-4f04-9f85-cee6c1de684c Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Agent-Logs-Url: https://github.com/demaconsulting/BuildMark/sessions/1faac23d-63db-4f04-9f85-cee6c1de684c Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Agent-Logs-Url: https://github.com/demaconsulting/BuildMark/sessions/1faac23d-63db-4f04-9f85-cee6c1de684c Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
…S1192) Agent-Logs-Url: https://github.com/demaconsulting/BuildMark/sessions/1faac23d-63db-4f04-9f85-cee6c1de684c Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
Malcolmnixon
April 11, 2026 16:10
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses static analysis findings (SonarQube/CodeQL/.NET analyzers) with behavior-preserving refactors across the BuildMark tool and its test suite.
Changes:
- Modernize collection initialization patterns using C# collection expressions (
[]) andToHashSet(...). - Update MSTest assertions to use the generic
Assert.IsInstanceOfType<T>()overloads. - Centralize the repeated Markdown empty-section placeholder (
"- N/A") into a single constant inBuildInformation.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/DemaConsulting.BuildMark.Tests/Version/VersionTests.cs | Switches to generic Assert.IsInstanceOfType<T>() overloads. |
| test/DemaConsulting.BuildMark.Tests/RepoConnectors/RepoConnectorsTests.cs | Uses collection expressions for test data setup lists. |
| test/DemaConsulting.BuildMark.Tests/RepoConnectors/RepoConnectorBaseTests.cs | Uses collection expressions for rules/sections/items test setup. |
| test/DemaConsulting.BuildMark.Tests/RepoConnectors/Mock/MockRepoConnectorTests.cs | Uses collection expressions for rules/sections setup in mock connector tests. |
| test/DemaConsulting.BuildMark.Tests/RepoConnectors/GitHub/GitHubRepoConnectorTests.cs | Uses collection expressions for rules/sections setup in GitHub connector tests. |
| test/DemaConsulting.BuildMark.Tests/RepoConnectors/AzureDevOps/AzureDevOpsRepoConnectorTests.cs | Uses collection expressions for rules/sections setup in Azure DevOps connector tests. |
| test/DemaConsulting.BuildMark.Tests/IntegrationTests.cs | Uses collection expressions for temporary item buckets in integration test scaffolding. |
| test/DemaConsulting.BuildMark.Tests/BuildNotes/BuildInformationTests.cs | Uses collection expressions for routed sections test setup. |
| src/DemaConsulting.BuildMark/SelfTest/Validation.cs | Uses collection expressions for self-test connector configuration and argument building. |
| src/DemaConsulting.BuildMark/RepoConnectors/ItemRouter.cs | Simplifies bucket initialization with collection expressions. |
| src/DemaConsulting.BuildMark/RepoConnectors/GitHub/GitHubRepoConnector.cs | Replaces HashSet constructors with ToHashSet() for lookup data construction. |
| src/DemaConsulting.BuildMark/RepoConnectors/AzureDevOps/AzureDevOpsRepoConnector.cs | Uses ToHashSet(StringComparer.Ordinal) for commit hash set construction. |
| src/DemaConsulting.BuildMark/Configuration/BuildMarkConfigReader.cs | Uses collection expression for initializing the issues list. |
| src/DemaConsulting.BuildMark/BuildNotes/BuildInformation.cs | Extracts repeated "- N/A" into a single NoItemsPlaceholder constant. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Apr 12, 2026
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.
Pull Request
Description
Address static analysis findings from SonarQube and CodeQL across source and test code. All changes are behavior-preserving.
new List<T>()→[],new HashSet<T>()→.ToHashSet()) across 11 filesAssert.IsInstanceOfType<T>()in VersionTests (13 call sites)"- N/A"literal toNoItemsPlaceholderconstant in BuildInformationExample:
Type of Change
Related Issues
Pre-Submission Checklist
Before submitting this pull request, ensure you have completed the following:
Build and Test
dotnet build --configuration Releasedotnet test --configuration Releasedotnet run --project src/DemaConsulting.BuildMark --configuration Release --framework net10.0--no-build -- --validateCode Quality
dotnet format --verify-no-changesQuality Checks
Please run the following checks before submitting:
./lint.sh(Unix/macOS) orcmd /c lint.bat/./lint.bat(Windows)Testing
Documentation
Additional Notes
467 tests pass across net8.0, net9.0, and net10.0. CodeQL scan: 0 alerts.