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 S2701 FP: avoid raising for xUnit Assert.True() #8823

Merged
merged 1 commit into from
Feb 28, 2024

Conversation

cristian-ambrosini-sonarsource
Copy link
Contributor

@cristian-ambrosini-sonarsource cristian-ambrosini-sonarsource commented Feb 28, 2024

S2701 is not raising for Assert.True in xUnit because Assert.Fail was introduced in 2020 version 2.4.2 and Assert.True(false, message) was a way to simulate it. Now that we are promoting this rule to SonarWay we want to play it safe and avoid raising also for Assert.False for the same reason Assert.False(true, message).

Copy link

sonarcloud bot commented Feb 28, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link

sonarcloud bot commented Feb 28, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@sebastien-marichal sebastien-marichal left a comment

Choose a reason for hiding this comment

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

LGTM!

@cristian-ambrosini-sonarsource cristian-ambrosini-sonarsource merged commit 95a7dca into master Feb 28, 2024
29 checks passed
@cristian-ambrosini-sonarsource cristian-ambrosini-sonarsource deleted the cristian/fix-S2701-FP branch February 28, 2024 14:56
@cristian-ambrosini-sonarsource cristian-ambrosini-sonarsource added Area: C# C# rules related issues. Type: False Positive Rule IS triggered when it shouldn't be. labels Feb 28, 2024
@cristian-ambrosini-sonarsource cristian-ambrosini-sonarsource added this to the 9.21 milestone Feb 29, 2024
@cristian-ambrosini-sonarsource
Copy link
Contributor Author

Peach validation: Lost 51 issues, all TN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Type: False Positive Rule IS triggered when it shouldn't be.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants