-
Notifications
You must be signed in to change notification settings - Fork 231
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
New Rule: S2925 Do not use Thread.Sleep() in a test #6185
New Rule: S2925 Do not use Thread.Sleep() in a test #6185
Conversation
b82ca9c
to
ddc4a9a
Compare
@pavel-mikula-sonarsource Any thoughts on this one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I'll prepare the rspec scaffolding later
analyzers/tests/SonarAnalyzer.UnitTest/TestCases/TestsShouldNotUseThreadSleep.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.UnitTest/TestCases/TestsShouldNotUseThreadSleep.cs
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.UnitTest/TestCases/TestsShouldNotUseThreadSleep.cs
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.UnitTest/Rules/TestsShouldNotUseThreadSleepTest.cs
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.Common/Rules/TestsShouldNotUseThreadSleepBase.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.Common/Rules/TestsShouldNotUseThreadSleepBase.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.UnitTest/TestCases/TestsShouldNotUseThreadSleep.cs
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.UnitTest/TestCases/TestsShouldNotUseThreadSleep.cs
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.Common/Rules/TestsShouldNotUseThreadSleepBase.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.CSharp/Rules/TestsShouldNotUseThreadSleep.cs
Outdated
Show resolved
Hide resolved
8e63255
to
f63801f
Compare
94d1cd6
to
2b0b9f7
Compare
@pavel-mikula-sonarsource I think I addressed all issues. I also did a rebase. |
analyzers/src/SonarAnalyzer.VisualBasic/Rules/TestsShouldNotUseThreadSleep.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.Common/Rules/TestsShouldNotUseThreadSleepBase.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still looks good.
I'll prepare the RSPEC
analyzers/src/SonarAnalyzer.Common/Rules/TestsShouldNotUseThreadSleepBase.cs
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.Common/Rules/TestsShouldNotUseThreadSleepBase.cs
Outdated
Show resolved
Hide resolved
I've asked @gregory-paidis-sonarsource to prepare the rule in rspec repo |
@pavel-mikula-sonarsource RSPEC PR can be found here Don't spend time reviewing the PR, but please take a look at the VB.NET snippets :) |
…tUseThreadSleep.cs Co-authored-by: Pavel Mikula <[email protected]> Update analyzers/src/SonarAnalyzer.Common/Rules/TestsShouldNotUseThreadSleepBase.cs Co-authored-by: Pavel Mikula <[email protected]> Update analyzers/src/SonarAnalyzer.Common/Rules/TestsShouldNotUseThreadSleepBase.cs Co-authored-by: Pavel Mikula <[email protected]>
…adSleepBase.cs Co-authored-by: Pavel Mikula <[email protected]>
fc46943
to
2b6052c
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
3e8cba8
to
6e7e96f
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
100% coverage. Do we already want to add a case for an ignored test as FP? |
I wouldn't consider ignored as FP. It's still a test that might be un-ignored later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for the contribution.
I'll merge this after a version bump, master is currently frozen.
In |
Sounds good. |
Please add UT in the other PR. This one is good to be merged as is. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Kudos, SonarCloud Quality Gate passed! |
Kudos, SonarCloud Quality Gate passed! |
Fixes #7342