Repository navigation
[code-simplifier] Simplify validation and flush logic for improved clarity - #8538
Merged
Amaury Levé (Evangelink) merged 1 commit intoMay 25, 2026
Merged
Conversation
- Use C# index-from-end operators (^1, ..^1) in TryParseTimeoutArgument
- Use nested pattern matching ('h' or 'm' or 's') for clearer unit validation
- Reorder ShouldFlushUnsafe conditions to check empty state first, then force flag
- All tests pass - no functional changes
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR performs small, behavior-preserving simplifications in Microsoft.Testing.Platform command-line parsing and the Azure DevOps live publishing flush decision logic, aiming to improve readability and consistency with modern C# syntax.
Changes:
- Simplifies
--timeoutparsing by using index/range-from-end operators and anorpattern for unit validation. - Reorders
ShouldFlushUnsafechecks to short-circuit on “no pending results” before evaluatingforceand interval conditions.
Show a summary per file
| File | Description |
|---|---|
| src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs | Uses arg[^1], arg[..^1], and is not ('h' or 'm' or 's') to simplify timeout unit/value parsing without changing validation behavior. |
| src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsTestResultsPublisher.cs | Reorders ShouldFlushUnsafe conditions to check for empty pending state first, then force, keeping logic equivalent but clearer. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
Amaury Levé (Evangelink)
marked this pull request as ready for review
May 25, 2026 10:40
Amaury Levé (Evangelink)
deleted the
code-simplifier/2026-05-24-f5d5dcff8343b3b6
branch
May 25, 2026 11:26
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.
Code Simplification - 2026-05-24
This PR simplifies recently modified code to improve clarity, consistency, and maintainability while preserving all functionality.
Files Simplified
src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs- Simplified timeout parsing with modern C# syntaxsrc/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsTestResultsPublisher.cs- Improved flush condition ordering for clarityImprovements Made
Modern C# Syntax
arg[arg.Length - 1]witharg[^1](index-from-end operator)arg[..(arg.Length - 1)]witharg[..^1](range-from-end operator)is not 'h' and not 'm' and not 's'tois not ('h' or 'm' or 's')(nested pattern matching)Enhanced Clarity
ShouldFlushUnsafeconditions to check empty state first, making the logic flow more intuitiveApplied Project Standards
Changes Based On
Recent changes from:
Testing
Review Focus
Please verify:
Automated by Code Simplifier Agent
Note
🔒 Integrity filter blocked 1 item
The following item was blocked because it doesn't meet the GitHub integrity level.
search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter:Add this agentic workflows to your repo
To install this agentic workflow, run