fix: address SonarCloud code smell issues in TrxSerializer#135
Merged
Malcolmnixon merged 1 commit intomainfrom Apr 3, 2026
Merged
fix: address SonarCloud code smell issues in TrxSerializer#135Malcolmnixon merged 1 commit intomainfrom
Malcolmnixon merged 1 commit intomainfrom
Conversation
Agent-Logs-Url: https://github.com/demaconsulting/TestResults/sessions/abd6bd89-9755-4bbc-8405-8be8a363d47c Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
Malcolmnixon
April 3, 2026 11:44
View session
Malcolmnixon
approved these changes
Apr 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Addresses SonarCloud/MSTest analyzer code-smell findings in TRX serialization and related unit tests, aiming for cleaner and more analyzer-compliant implementations without intended behavior changes.
Changes:
- Narrows
ParseTestResultlookup parameter type toDictionary<string, XElement>to satisfy CA1859. - Replaces
Enum.IsDefined(typeof(TestOutcome), outcome)with the genericEnum.IsDefined<TestOutcome>(outcome)overload (CA2263). - Updates duration assertions in
TrxSerializerTeststo useAssert.IsLessThaninstead ofAssert.IsTruewith a comparison (MSTEST0037).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/DemaConsulting.TestResults/IO/TrxSerializer.cs | Analyzer-driven refactors in parsing helpers (ParseTestResult, ParseTestOutcome). |
| test/DemaConsulting.TestResults.Tests/IO/TrxSerializerTests.cs | Replaces tolerance checks with Assert.IsLessThan per MSTest analyzer guidance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Apr 3, 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
Resolves six SonarCloud INFO/CODE_SMELL diagnostics in
TrxSerializer.csandTrxSerializerTests.cs.TrxSerializer.csParseTestResultparameter narrowed fromIReadOnlyDictionary<string, XElement>toDictionary<string, XElement>— safe sinceBuildTestMethodLookupalready returnsDictionaryEnum.IsDefined<TestOutcome>(outcome)overloadTrxSerializerTests.csAssert.IsTrue(Math.Abs(...) < 0.001)withAssert.IsLessThan(0.001, Math.Abs(...)):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 ReleaseCode 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
No behaviour changes — purely diagnostic-driven code quality fixes.