-
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
Fix S2187 FP: Support test attributes deriving from ITestBuilder
in NUnit
#5565
Fix S2187 FP: Support test attributes deriving from ITestBuilder
in NUnit
#5565
Conversation
NUnit3 added support for custom test attributes via the ITestBuilder interface. The analyzer for S2187 would not consider test methods decorated with such attributes, giving a false positive result if the fixture only contained such methods. Because this interface only exists in NUnit3, tests for it are split into a separate file, so that analyzer tests can be executed only for NUnit version 3.0.0 and up.
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.
Hi @dammejed, thank you for giving this a try.
I left a few nitpicks in the test refactoring to address. And I expect one of the UTs to fail due to a missing line.
analyzers/tests/SonarAnalyzer.UnitTest/Rules/TestClassShouldHaveTestMethodTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.UnitTest/Rules/TestClassShouldHaveTestMethodTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.UnitTest/Rules/TestClassShouldHaveTestMethodTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.UnitTest/Rules/TestClassShouldHaveTestMethodTest.cs
Outdated
Show resolved
Hide resolved
/azp run Sonar.Net.External |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run Sonar.Net |
Azure Pipelines successfully started running 1 pipeline(s). |
1d06c36
to
a8ed90b
Compare
I made the changes-- sorry for the sloppiness with the unit test! |
No worries. It was actually pretty good. |
/azp run Sonar.Net |
Azure Pipelines successfully started running 1 pipeline(s). |
SonarCloud Quality Gate failed. |
Kudos, SonarCloud Quality Gate passed! |
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 🎉
ITestBuilder
in NUnit
Thanks for the quick turnaround! |
Fixes #5564