Skip to content

Fix S2701 FP: avoid raising for xUnit Assert.True()#8823

Merged
cristian-ambrosini-sonarsource merged 1 commit intomasterfrom
cristian/fix-S2701-FP
Feb 28, 2024
Merged

Fix S2701 FP: avoid raising for xUnit Assert.True()#8823
cristian-ambrosini-sonarsource merged 1 commit intomasterfrom
cristian/fix-S2701-FP

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).

@sonarqubecloud
Copy link

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

@sonarqubecloud
Copy link

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
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

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