Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup the Polly and Polly.Specs codebase #1290

Closed
martintmk opened this issue Jun 14, 2023 · 6 comments · Fixed by #2467
Closed

Cleanup the Polly and Polly.Specs codebase #1290

martintmk opened this issue Jun 14, 2023 · 6 comments · Fixed by #2467
Assignees
Labels
enhancement Hacktoberfest Suggested contribution for Hacktoberfest

Comments

@martintmk
Copy link
Contributor

In the #1287 we enabled a full set of analyzers for these projects. Many of the rules are currently suppressed in each respective csproj file with the <NoWarn> element.

We can enable these rules one-be-one and cleanup the codebase.

@martincostello martincostello added the help wanted A change up for grabs for contributions from the community label Jun 16, 2023
IgorIgorevich94 added a commit to IgorIgorevich94/Polly that referenced this issue Aug 26, 2023
IgorIgorevich94 added a commit to IgorIgorevich94/Polly that referenced this issue Aug 28, 2023
Co-authored-by: Martin Costello <martin@martincostello.com>
@martincostello martincostello added the Hacktoberfest Suggested contribution for Hacktoberfest label Sep 28, 2023
@davidCett
Copy link

Hi👋I would like to help with this issue

@martincostello
Copy link
Member

@davidCett Thanks for volunteering! Feel free to open a pull request to tackle one of the disabled warnings. I suggest you tackle one or two per pull request to prevent the diffs getting too big to easily review.

@sukreshmanda
Copy link
Contributor

For the warnings xUnit1031, it says blocking calls should not be used in a test method. The below mentioned code uses Task.WaitAll which is a blocking action.

Example :

#pragma warning disable xUnit1031 // Do not use blocking task operations in test method

Task.WaitAll([firstExecution, secondExecution], testTimeoutToExposeDeadlocks).Should().BeTrue();

#pragma warning restore xUnit1031 // Do not use blocking task operations in test method

The essence of the above lines is to check if firstExecution and secondExecution tasks finishes before the specified timeout (testTimeoutToExposeDeadlocks). I want to confirm if the below mentioned non-blocking code can be a proper replacement for the above code.

var allTasksTask = Task.WhenAll(firstExecution, secondExecution);

var completedTask = await Task.WhenAny(allTasksTask, Task.Delay(testTimeoutToExposeDeadlocks));

(completedTask == allTasksTask).Should().BeTrue();

@martincostello
Copy link
Member

If I remember correctly, these tests are specifically testing synchronous code paths, so the suppressions should be left in place.

This was referenced Sep 25, 2024
martincostello pushed a commit that referenced this issue Sep 28, 2024
Contributes to #1290.
@gabidabet gabidabet mentioned this issue Sep 28, 2024
4 tasks
martincostello pushed a commit that referenced this issue Sep 29, 2024
@martincostello martincostello self-assigned this Jan 28, 2025
@martincostello martincostello removed up-for-grabs help wanted A change up for grabs for contributions from the community labels Jan 28, 2025
@martincostello
Copy link
Member

Final clean-up in #2467.

Any remaining formatting inconsistencies aren't worth clearing up en-masse and can just optionally be tackled if/when files otherwise are being changed for other purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Hacktoberfest Suggested contribution for Hacktoberfest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants