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

Emit CA2251 when comparing string.Compare with 0 using Equals #6727

Merged
merged 4 commits into from
Jul 3, 2023

Conversation

CollinAlpert
Copy link
Contributor

This PR fixes a false negative where CA2251 is not reported when comparing the result of string.Compare with 0 using the int.Equals method.

Fixes #6609

@CollinAlpert CollinAlpert requested a review from a team as a code owner July 2, 2023 09:36
@codecov
Copy link

codecov bot commented Jul 2, 2023

Codecov Report

Merging #6727 (925976a) into main (9653f96) will decrease coverage by 0.01%.
The diff coverage is 83.72%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6727      +/-   ##
==========================================
- Coverage   96.33%   96.33%   -0.01%     
==========================================
  Files        1393     1393              
  Lines      325082   325146      +64     
  Branches    10711    10723      +12     
==========================================
+ Hits       313160   313215      +55     
- Misses       9217     9219       +2     
- Partials     2705     2712       +7     

@mavasani
Copy link
Contributor

mavasani commented Jul 3, 2023

Thank you @CollinAlpert

@mavasani mavasani merged commit 24890c9 into dotnet:main Jul 3, 2023
@CollinAlpert CollinAlpert deleted the issue_6609 branch July 3, 2023 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CA2251 Use String.Equals over String.Compare misses
2 participants