Skip to content

Simplify code#2740

Merged
martincostello merged 3 commits intomainfrom
fix-analyzer-warnings
Sep 6, 2025
Merged

Simplify code#2740
martincostello merged 3 commits intomainfrom
fix-analyzer-warnings

Conversation

@martincostello
Copy link
Member

Apply AD0001 and AD0002 code fixes.

Apply `AD0001` and `AD0002` code fixes.
@codecov
Copy link

codecov bot commented Sep 6, 2025

Codecov Report

❌ Patch coverage is 94.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.15%. Comparing base (58a53a8) to head (95a9c70).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/Polly/Wrap/AsyncPolicyWrap.cs 80.00% 1 Missing ⚠️
src/Polly/Wrap/AsyncPolicyWrapEngine.cs 75.00% 1 Missing ⚠️
src/Polly/Wrap/PolicyWrap.cs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2740      +/-   ##
==========================================
+ Coverage   96.12%   96.15%   +0.02%     
==========================================
  Files         309      309              
  Lines        7118     7118              
  Branches     1008     1008              
==========================================
+ Hits         6842     6844       +2     
+ Misses        222      221       -1     
+ Partials       54       53       -1     
Flag Coverage Δ
linux 96.15% <94.00%> (+0.02%) ⬆️
macos 96.15% <94.00%> (+0.02%) ⬆️
windows 96.14% <94.00%> (+0.02%) ⬆️

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
Copy link
Member Author

martincostello commented Sep 6, 2025

Coverage fall suggests not all of these are strictly correct and change the semantics.

Actually, might just be a flaky test.

Update documentation snippets.
Add missing test coverage for `Cache<string>`.
@martincostello martincostello marked this pull request as ready for review September 6, 2025 13:59
Copilot AI review requested due to automatic review settings September 6, 2025 13:59
@martincostello martincostello enabled auto-merge (squash) September 6, 2025 13:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR applies AD0001 and AD0002 code fixes to simplify the codebase by removing unnecessary generic type parameters from method calls where the compiler can infer the types automatically.

  • Removed redundant generic type parameters from various method calls across test and source files
  • Simplified XML documentation references by removing fully qualified namespaces where unnecessary
  • Updated one test method to use CancellationToken.None instead of the fully qualified version

Reviewed Changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/Polly.Specs/Caching/CacheTResultSpecs.cs Adds a new test method for cache behavior with ICacheKeyStrategy
test/Polly.RateLimiting.Tests/RateLimiterResiliencePipelineBuilderExtensionsTests.cs Simplified CancellationToken.None reference
test/Polly.Core.Tests/Simmy/Outcomes/ChaosOutcomeStrategyTests.cs Removed generic type parameter from ExecuteAsync call
test/Polly.Core.Tests/Hedging/Controller/TaskExecutionTests.cs Removed generic type parameters from InitializeAsync calls
src/Snippets/Docs/Migration.Registry.cs Simplified TryGetPipeline method call
src/Snippets/Docs/Migration.Execute.cs Removed generic type parameters from ExecuteOutcomeAsync calls
src/Snippets/Docs/Fallback.cs Removed generic type parameters from ExecuteOutcomeAsync calls
src/Snippets/Docs/CircuitBreaker.cs Removed generic type parameters from ExecuteOutcomeAsync calls
src/Polly/Wrap/PolicyWrapEngine.cs Removed generic type parameters from Execute method calls
src/Polly/Wrap/PolicyWrap.cs Removed generic type parameters from PolicyWrapEngine.Implementation calls
src/Polly/Wrap/AsyncPolicyWrapEngine.cs Removed generic type parameters from ExecuteAsync method calls
src/Polly/Wrap/AsyncPolicyWrap.cs Removed generic type parameters from AsyncPolicyWrapEngine.ImplementationAsync calls
src/Polly/Timeout/TimeoutStrategy.cs Simplified XML documentation references
src/Polly/PolicyBuilder.cs Simplified XML documentation references
src/Polly/Fallback/AsyncFallbackPolicy.cs Removed generic type parameter from AsyncFallbackEngine.ImplementationAsync call
src/Polly/CircuitBreaker/CircuitBreakerPolicy.cs Removed generic type parameter from CircuitBreakerEngine.Implementation call
src/Polly/CircuitBreaker/AsyncCircuitBreakerPolicy.cs Removed generic type parameter from AsyncCircuitBreakerEngine.ImplementationAsync call
src/Polly/Caching/CacheTResultSyntax.cs Removed generic type parameters from Cache method calls
src/Polly/Caching/CachePolicy.cs Removed generic type parameter from CacheEngine.Implementation call
src/Polly/Caching/AsyncCachePolicy.cs Removed generic type parameters from AsyncCacheEngine.ImplementationAsync calls
src/Polly/AsyncPolicy.NonGenericImplementation.cs Removed generic type parameter from ImplementationAsync call
src/Polly.Core/ResiliencePipelineT.Async.cs Simplified XML documentation reference
src/Polly.Core/ResiliencePipelineBuilderBase.cs Simplified XML documentation references
src/Polly.Core/ResiliencePipeline.AsyncT.cs Simplified XML documentation reference
src/LegacySupport/RequiresUnreferencedCodeAttribute.cs Simplified XML documentation reference
src/LegacySupport/DynamicallyAccessedMembersAttribute.cs Simplified XML documentation reference
docs/strategies/fallback.md Removed generic type parameters from ExecuteOutcomeAsync calls in documentation
docs/strategies/circuit-breaker.md Removed generic type parameters from ExecuteOutcomeAsync calls in documentation
docs/migration-v8.md Removed generic type parameters from ExecuteOutcomeAsync and TryGetPipeline calls in documentation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@martincostello martincostello merged commit 6598319 into main Sep 6, 2025
27 of 28 checks passed
@martincostello martincostello deleted the fix-analyzer-warnings branch September 6, 2025 14:01
PhilipWoulfe pushed a commit to PhilipWoulfe/F1Competition that referenced this pull request Mar 2, 2026
[//]: # (dependabot-start)
⚠️  **Dependabot is rebasing this PR** ⚠️ 

Rebasing might not happen immediately, so don't worry if this takes some
time.

Note: if you make any changes to this PR yourself, they will take
precedence over the rebase.

---

[//]: # (dependabot-end)

Updated [Polly](https://github.com/App-vNext/Polly) from 8.5.2 to 8.6.5.

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

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

## 8.6.5

## What's Changed

* Extend NuGet package validation by @​martincostello in
App-vNext/Polly#2762
* Suppress S2094 warning by @​martincostello in
App-vNext/Polly#2765
* Refactor cake script by @​martincostello in
App-vNext/Polly#2769
* Pass timeout to `TimeoutRejectedException` by @​martincostello in
App-vNext/Polly#2827

**Full Changelog**:
App-vNext/Polly@8.6.4...8.6.5


## 8.6.4

## What's Changed

* Fix after-release and update CHANGELOG by @​martincostello in
App-vNext/Polly#2714
* Use collection expressions by @​martincostello in
App-vNext/Polly#2715
* Fix flaky mutants by @​martincostello in
App-vNext/Polly#2717
* fix documentation for ExecuteOutcomeAsync by @​carvex21 in
App-vNext/Polly#2710
* Bump MartinCostello.WaitForNuGetPackage by @​martincostello in
App-vNext/Polly#2721
* Bump sign tool by @​martincostello in
App-vNext/Polly#2722
* xunit v3 preparation by @​martincostello in
App-vNext/Polly#2723
* Add summary NuGet badges by @​martincostello in
App-vNext/Polly#2724
* Delete actionlint config by @​martincostello in
App-vNext/Polly#2730
* RateLimiting: add typed builder/guard tests and external limiter
lifetime test by @​mohammed-saalim in
App-vNext/Polly#2711
* Update Dependabot auto-merge conditions by @​martincostello in
App-vNext/Polly#2736
* Bump NuGet packages by @​martincostello in
App-vNext/Polly#2738
* Bump dotnet-stryker to 4.8.1 by @​martincostello in
App-vNext/Polly#2739
* Simplify code by @​martincostello in
App-vNext/Polly#2740
* Update zizmor by @​martincostello in
App-vNext/Polly#2746
* Use NuGet Trusted Publishing by @​martincostello in
App-vNext/Polly#2751
* Respect override for PipelineExecuting and PipelineExecuted by
@​peter-csala in App-vNext/Polly#2752

## New Contributors

* @​carvex21 made their first contribution in
App-vNext/Polly#2710
* @​mohammed-saalim made their first contribution in
App-vNext/Polly#2711

**Full Changelog**:
App-vNext/Polly@8.6.3...8.6.4


## 8.6.3

## What's Changed

* Add release notes configuration by @​martincostello in
App-vNext/Polly#2678
* Simplify release workflow by @​martincostello in
App-vNext/Polly#2679
* Sign-off commits by @​martincostello in
App-vNext/Polly#2694
* Add GitHub sponsorship by @​martincostello in
App-vNext/Polly#2695
* Refactor project dependencies by @​martincostello in
App-vNext/Polly#2696
* Add zizmor by @​martincostello in
App-vNext/Polly#2698
* Update benchmarks by @​martincostello in
App-vNext/Polly#2712
* Reduce async overhead by @​pentp in
App-vNext/Polly#2664
* Update benchmarks by @​martincostello in
App-vNext/Polly#2713

## New Contributors

* @​pentp made their first contribution in
App-vNext/Polly#2664

**Full Changelog**:
App-vNext/Polly@8.6.2...8.6.3


## 8.6.2

## What's Changed

* Performance tweaks by @​martincostello in
App-vNext/Polly#2667
* Update dependencies by @​martincostello in
App-vNext/Polly#2668
* Update benchmark results by @​martincostello in
App-vNext/Polly#2669

## New Contributors

* @​pentp made their first contribution in
App-vNext/Polly#2667

**Full Changelog**:
App-vNext/Polly@8.6.1...8.6.2


## 8.6.1

## What's Changed

* Fix integer overflow in `BulkheadSemaphoreFactory` by @​ahusseini in
App-vNext/Polly#2638
* Generate SBOM by @​martincostello in
App-vNext/Polly#2640
* Attest artifacts by @​martincostello in
App-vNext/Polly#2647

## New Contributors

* @​ahusseini made their first contribution in
App-vNext/Polly#2638

**Full Changelog**:
App-vNext/Polly@8.6.0...8.6.1

## 8.6.0

## What's Changed

* Bump Stryker by @​martincostello in
App-vNext/Polly#2476
* Fix chaos example issue and enrich notes & diagram by @​caigen in
App-vNext/Polly#2482
* Add diagram for the main chaos page sample by @​peter-csala in
App-vNext/Polly#2484
* Fix broken CI by @​martincostello in
App-vNext/Polly#2497
* Remove .NET 6 SDK by @​martincostello in
App-vNext/Polly#2501
* Use Stryker Mutator Dashboard by @​martincostello in
App-vNext/Polly#2500
* Fix Polly.Testing mutations by @​martincostello in
App-vNext/Polly#2503
* Lint PowerShell scripts by @​martincostello in
App-vNext/Polly#2504
* Improve Polly coverage by @​martincostello in
App-vNext/Polly#2505
* Improve mutation score by @​martincostello in
App-vNext/Polly#2506
* Run CodeQL for GitHub Actions by @​martincostello in
App-vNext/Polly#2498
* Add missing mutations by @​martincostello in
App-vNext/Polly#2508
* Remove dotnet tool restore by @​martincostello in
App-vNext/Polly#2513
* Add missing coverage by @​martincostello in
App-vNext/Polly#2514
* Improve mutation test perf by @​slang25 in
App-vNext/Polly#2520
* Improve coverage by @​martincostello in
App-vNext/Polly#2526
* Remove System.Text.Json reference by @​martincostello in
App-vNext/Polly#2532
* Fix test summary reliability by @​martincostello in
App-vNext/Polly#2543
* Use AuthenticodeLint by @​martincostello in
App-vNext/Polly#2553
* Use actions/create-github-app-token by @​martincostello in
App-vNext/Polly#2572
* Fix Retry strategy ShouldHandle in example code by @​marcrocny in
App-vNext/Polly#2527
* Tweak docs formatting by @​martincostello in
App-vNext/Polly#2575
* Dispose registry which contains rate limiters by @​peter-csala in
App-vNext/Polly#2578
* Improve mutation tests performance by ensuring solution file isn't
discovered by @​slang25 in App-vNext/Polly#2589
* Update LICENSE metadata by @​martincostello in
App-vNext/Polly#2590
* Add HTTP client integration samples by @​peter-csala in
App-vNext/Polly#2587
* Dedupe links by @​martincostello in
App-vNext/Polly#2592
* Add test analytics by @​martincostello in
App-vNext/Polly#2593
* Add note about context/state mix-ups by @​martincostello in
App-vNext/Polly#2598
* Emit annotation for packages by @​martincostello in
App-vNext/Polly#2601
* Add `AttemptNumber` to `HedgingPredicateArguments` by @​peter-csala in
App-vNext/Polly#2603
* .NET 10 preparation by @​martincostello in
App-vNext/Polly#2620
* Migrate to slnx by @​martincostello in
App-vNext/Polly#2623
* Fix `OnRetryArguments` comments by @​lchaoer in
App-vNext/Polly#2627
* Fix package signing by @​martincostello in
App-vNext/Polly#2631

## New Contributors

* @​caigen made their first contribution in
App-vNext/Polly#2482
* @​slang25 made their first contribution in
App-vNext/Polly#2520
* @​marcrocny made their first contribution in
App-vNext/Polly#2527
* @​lchaoer made their first contribution in
App-vNext/Polly#2627

**Full Changelog**:
App-vNext/Polly@8.5.2...8.6.0

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

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Polly&package-manager=nuget&previous-version=8.5.2&new-version=8.6.5)](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>
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