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 S3897: Correctly recognize IEquatable<T> implementations from base classes #376

Closed
valhristov opened this issue May 29, 2017 · 2 comments
Labels
Type: False Positive Rule IS triggered when it shouldn't be.
Milestone

Comments

@valhristov
Copy link
Contributor

valhristov commented May 29, 2017

Investigate why the following code is not compliant and provide a fix:

class MyClass : IEquatable<MyClass> // Compliant
{
    public override bool Equals(object obj)
    {
        return Equals(obj as MyClass);
    }
    public bool Equals(MyClass other)
    {
        return true;
    }
}

class SubClass : MyClass, IEquatable<SubClass> // Compliant?
{
    public override bool Equals(object obj)
    {
        return Equals(obj as SubClass);
    }
    public bool Equals(SubClass other)
    {
        return true;
    }
}

Source

@valhristov valhristov added Area: Rules Type: False Positive Rule IS triggered when it shouldn't be. labels May 29, 2017
@valhristov valhristov added this to the 5.12 milestone May 29, 2017
@Evangelink Evangelink self-assigned this Jun 9, 2017
@Evangelink Evangelink modified the milestones: near-future, 6.0 Jun 9, 2017
@Evangelink Evangelink removed their assignment Jun 9, 2017
@valhristov valhristov modified the milestones: near-future, 6.1 Jun 13, 2017
@overeemm
Copy link

I've attempted to fix this, but it isn't complete yet. #429

@Evangelink
Copy link
Contributor

This is fixed by #464

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
None yet
Development

No branches or pull requests

3 participants