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 S3875 FP: Do not raise an issue when implementing IEqualityOperators interface #6312

Closed
csaba-sagi-sonarsource opened this issue Nov 7, 2022 · 0 comments · Fixed by #6316
Assignees
Labels
Type: False Positive Rule IS triggered when it shouldn't be.
Milestone

Comments

@csaba-sagi-sonarsource
Copy link
Contributor

Description

FP for S3875 (DotNotOverloadOperatorEqual).

When implementing IEqualityOperators interface the rule should not raise.

Repro steps

    class MyClass : IEqualityOperators<MyClass, MyClass, MyClass>
    {
        public static MyClass operator ==(MyClass? left, MyClass? right) => new MyClass(); // Noncompliant FP (implementing IEqualityOperators interface require == operator overload)
        
        public static MyClass operator !=(MyClass? left, MyClass? right) => new MyClass();
    }

Expected behavior

The issue should not be raised in this case.

Actual behavior

An issue is raised.

@csaba-sagi-sonarsource csaba-sagi-sonarsource added Area: C# 11 Type: False Positive Rule IS triggered when it shouldn't be. labels Nov 7, 2022
@github-actions github-actions bot added this to False Positive in Backlog Nov 7, 2022
@csaba-sagi-sonarsource csaba-sagi-sonarsource added this to the 8.49 milestone Nov 7, 2022
@gregory-paidis-sonarsource gregory-paidis-sonarsource moved this from To do to In progress in Best Kanban Nov 7, 2022
@github-actions github-actions bot moved this from In progress to Review in progress in Best Kanban Nov 7, 2022
@github-actions github-actions bot moved this from Review in progress to Review approved in Best Kanban Nov 8, 2022
@gregory-paidis-sonarsource gregory-paidis-sonarsource moved this from Review approved to Review in progress in Best Kanban Nov 9, 2022
@github-actions github-actions bot moved this from Review in progress to In progress in Best Kanban Nov 11, 2022
@github-actions github-actions bot moved this from In progress to Review approved in Best Kanban Nov 14, 2022
@gregory-paidis-sonarsource gregory-paidis-sonarsource moved this from Review approved to Review in progress in Best Kanban Nov 14, 2022
@github-actions github-actions bot moved this from Review in progress to Review approved in Best Kanban Nov 14, 2022
Backlog automation moved this from False Positive to Done Nov 14, 2022
Best Kanban automation moved this from Review approved to Validate Peach Nov 14, 2022
@gregory-paidis-sonarsource gregory-paidis-sonarsource moved this from Validate Peach to Done in Best Kanban Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: False Positive Rule IS triggered when it shouldn't be.
Projects
Best Kanban
  
Done
Backlog
  
Done
3 participants