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

Fix S2187 FP: Support test attributes deriving from ITestBuilder in NUnit #5565

Merged
merged 2 commits into from
Apr 19, 2022

Conversation

dammejed
Copy link
Contributor

Fixes #5564

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.
Copy link
Contributor

@pavel-mikula-sonarsource pavel-mikula-sonarsource left a 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.

@pavel-mikula-sonarsource
Copy link
Contributor

/azp run Sonar.Net.External

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavel-mikula-sonarsource
Copy link
Contributor

/azp run Sonar.Net

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dammejed dammejed force-pushed the S2187-FP branch 2 times, most recently from 1d06c36 to a8ed90b Compare April 19, 2022 12:41
@dammejed
Copy link
Contributor Author

I made the changes-- sorry for the sloppiness with the unit test!

@pavel-mikula-sonarsource
Copy link
Contributor

I made the changes-- sorry for the sloppiness with the unit test!

No worries. It was actually pretty good.

@pavel-mikula-sonarsource
Copy link
Contributor

/azp run Sonar.Net

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

80.0% 80.0% Coverage
0.0% 0.0% Duplication

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Contributor

@pavel-mikula-sonarsource pavel-mikula-sonarsource left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@pavel-mikula-sonarsource pavel-mikula-sonarsource changed the title Add support for ITestBuilder attributes in NUnit. Fix S2187 FP: Support test attributes deriving from ITestBuilder in NUnit Apr 19, 2022
@pavel-mikula-sonarsource pavel-mikula-sonarsource merged commit 99412a1 into SonarSource:master Apr 19, 2022
@dammejed
Copy link
Contributor Author

Thanks for the quick turnaround!

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.

Fix S2187 FP: Support test attributes deriving from ITestBuilder in NUnit
2 participants