Skip to content

Formatting tweaks#3018

Merged
martincostello merged 1 commit into
mainfrom
formatting-tweaks
Apr 3, 2026
Merged

Formatting tweaks#3018
martincostello merged 1 commit into
mainfrom
formatting-tweaks

Conversation

@martincostello

Copy link
Copy Markdown
Member

Apply some refactoring spotted while experimenting with C# 15:

  • Add trailing commas.
  • Use primary constructors.
  • Use is instead of ==.
  • Simplify some pattern matching.

- Add trailing commas.
- Use primary constructors.
- Use `is` instead of `==`.
- Simplify some pattern matching.
Copilot AI review requested due to automatic review settings April 3, 2026 15:21
@martincostello martincostello enabled auto-merge (squash) April 3, 2026 15:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Refactors a set of tests, docs snippets, benchmarks, and one core utility type to adopt newer C# syntax patterns (primary constructors, constant patterns via is, simplified property patterns) and apply consistent trailing-comma formatting.

Changes:

  • Converted a few small helper/strategy classes to use primary constructors and inline field/property initialization.
  • Added trailing commas in object/collection/switch-expression initializers for formatting consistency.
  • Simplified select pattern-matching expressions (e.g., is constant patterns and property patterns).

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/Polly.Extensions.Tests/Telemetry/TelemetryListenerImplTests.cs Uses a primary constructor for a nested test enricher and initializes the callback field inline.
test/Polly.Extensions.Tests/ReloadableResiliencePipelineTests.cs Converts a test ResilienceStrategy to a primary constructor and inline auto-property initialization.
test/Polly.Extensions.Tests/Issues/IssuesTests.OnCircuitBreakWithServiceProvider_796.cs Adds trailing commas in switch arms and uses a primary constructor for a nested strategy.
test/Polly.Core.Tests/Issues/IssuesTests.CircuitBreakerStateSharing_959.cs Uses is constant patterns in switch guards for readability.
src/Snippets/Docs/ResilienceStrategies.cs Adds a trailing comma to the last switch arm in a docs snippet.
src/Snippets/Docs/Migration.Retry.cs Simplifies a property pattern and adds trailing commas in a docs snippet switch.
src/Snippets/Docs/HttpClientIntegrations.cs Adds a trailing comma to the last switch arm in a docs snippet.
src/Snippets/Docs/Extensibility.cs Uses is constant patterns, adds trailing commas, and normalizes #endregion.
src/Snippets/Docs/Chaos.Outcome.cs Adds a trailing comma to the last switch arm in a docs snippet.
src/Polly.Core/Utils/Pipeline/BridgeComponentBase.cs Refactors constructor boilerplate into a primary constructor and inline field initialization.
bench/Polly.Core.Benchmarks/Utils/Helper.Retry.cs Adds trailing commas to switch arms and object initializer members in benchmark helper code.
bench/Polly.Core.Benchmarks/Utils/Helper.MultipleStrategies.cs Adds trailing commas in options initializers and switch expressions in benchmark helper code.
bench/Polly.Core.Benchmarks/Utils/Helper.CircuitBreaker.cs Adds trailing commas in switch expressions and removes a trailing blank line.
bench/Polly.Core.Benchmarks/PredicateBenchmark.cs Adds a trailing comma after the switch expression in an object initializer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Apr 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.16%. Comparing base (8fd8fc0) to head (537cd09).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3018   +/-   ##
=======================================
  Coverage   96.15%   96.16%           
=======================================
  Files         310      310           
  Lines        7135     7136    +1     
  Branches     1005     1005           
=======================================
+ Hits         6861     6862    +1     
  Misses        221      221           
  Partials       53       53           
Flag Coverage Δ
linux 96.16% <100.00%> (+<0.01%) ⬆️
macos 96.16% <100.00%> (+<0.01%) ⬆️
windows 96.15% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@martincostello martincostello merged commit ed3d603 into main Apr 3, 2026
38 of 39 checks passed
@martincostello martincostello deleted the formatting-tweaks branch April 3, 2026 15:39
IhateTrains pushed a commit to ParadoxGameConverters/ImperatorToCK3 that referenced this pull request Jun 11, 2026
Updated [Polly](https://github.com/App-vNext/Polly) from 8.6.6 to 8.7.0.

<details>
<summary>Release notes</summary>

_Sourced from [Polly's
releases](https://github.com/App-vNext/Polly/releases)._

## 8.7.0

## Highlights

* Adds caller cancellation token propagation in hedging and timeout
strategies by @​DaRosenberg in
App-vNext/Polly#3094
* Telemetry refactoring by @​martincostello in
App-vNext/Polly#2985

## What's Changed

* Update zizmor to 1.22.0 by @​martincostello in
App-vNext/Polly#2955
* Increase test timeout by @​martincostello in
App-vNext/Polly#2956
* Disable secrets-outside-env audit by @​martincostello in
App-vNext/Polly#2969
* Update zizmor to 1.23.1 by @​martincostello in
App-vNext/Polly#2970
* Update .NET NuGet packages by @​martincostello in
App-vNext/Polly#2982
* Add AGENTS.md by @​martincostello in
App-vNext/Polly#2983
* Fix typo in HTTP client integrations documentation by @​alexravenna in
App-vNext/Polly#2984
* Remove unused constant by @​martincostello in
App-vNext/Polly#2986
* Fix non-deterministic branch coverage in HedgingExecutionContext
hedging delay tests by @​Copilot in
App-vNext/Polly#2997
* Bump GitHubActionsTestLogger to 3.0.2 by @​martincostello in
App-vNext/Polly#3000
* Bump actionlint to v1.7.12 by @​martincostello in
App-vNext/Polly#3006
* Bump sign by @​martincostello in
App-vNext/Polly#3008
* Move Public API baselines by @​martincostello in
App-vNext/Polly#3016
* Formatting tweaks by @​martincostello in
App-vNext/Polly#3017
* Formatting tweaks by @​martincostello in
App-vNext/Polly#3018
* Remove ZIZMOR_VERSION by @​martincostello in
App-vNext/Polly#3025
* Assert nullable has result by @​martincostello in
App-vNext/Polly#3028
* Update deprecated action input by @​martincostello in
App-vNext/Polly#3035
* Move dependabot to Friday by @​martincostello in
App-vNext/Polly#3044
* Fix tag comment by @​martincostello in
App-vNext/Polly#3045
* Fix dependabot group by @​martincostello in
App-vNext/Polly#3047
* Pin runner images by @​martincostello in
App-vNext/Polly#3065
* Bump Refit to 10.2.0 by @​martincostello in
App-vNext/Polly#3096
* Disable Azure deployments by @​martincostello in
App-vNext/Polly#3105

## New Contributors

* @​alexravenna made their first contribution in
App-vNext/Polly#2984
* @​DaRosenberg made their first contribution in
App-vNext/Polly#3094

**Full Changelog**:
App-vNext/Polly@8.6.6...8.7.0


Commits viewable in [compare
view](App-vNext/Polly@8.6.6...8.7.0).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Polly&package-manager=nuget&previous-version=8.6.6&new-version=8.7.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This was referenced Jun 11, 2026
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