Clearing out the only 1805 violation using the method listed here: ht…#2032
Clearing out the only 1805 violation using the method listed here: ht…#2032cbredlow wants to merge 1 commit intoApp-vNext:mainfrom
Conversation
|
@dotnet-policy-service agree |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2032 +/- ##
==========================================
- Coverage 83.70% 83.66% -0.04%
==========================================
Files 312 312
Lines 7105 7106 +1
Branches 1054 1054
==========================================
- Hits 5947 5945 -2
- Misses 788 790 +2
- Partials 370 371 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
|
||
| #if !NETSTANDARD2_0 | ||
| private SpinWait spinner = default; | ||
| private static SpinWait spinner => default; |
There was a problem hiding this comment.
In this case I don't believe this is the correct change to make here.
Making this a static property means that each access to the spinner effectively resets the internal state it has as all usage of it now gets a fresh value instead of the state being maintained for the lifetime of an instance of the rate limiter.
Either instead of default we should change the original code to use new(), and if that still raises warnings, then we should just explicitly suppress the CA1805 warning instead.
|
I'm going to close this due to activity. If you'd like to continue with this contribution, please open a new PR that addresses the comment here: #2032 (comment) |
…tps://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1805#how-to-fix-violations
Pull Request
The issue or feature being addressed
Addressing the CA1805 as a part of issue 1290
Details on the issue fix or feature implementation
Removed the NoWarn for CA1805, and changes the spinner to be static and have a lambda for the default value, as suggested here: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1805#how-to-fix-violations
Confirm the following