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 S4143: FN for Add called on 'this' or 'base' #1921

Closed
andrei-epure-sonarsource opened this issue Sep 28, 2018 · 1 comment
Closed

Fix S4143: FN for Add called on 'this' or 'base' #1921

andrei-epure-sonarsource opened this issue Sep 28, 2018 · 1 comment
Assignees
Labels
Type: False Negative Rule is NOT triggered when it should be.
Milestone

Comments

@andrei-epure-sonarsource
Copy link
Contributor

Description

S4143 does not raise issued when the Add method is called on this or base

Expected behavior

class InheritanceTest : Dictionary<int, int>
{
    void InheritanceTest()
    {
        base.Add(0, 0); // Secondary
        base.Add(0, 1); // Noncompliant
    }
 }

Actual behavior

class InheritanceTest : Dictionary<int, int>
{
    void InheritanceTest()
    {
        base.Add(0, 0); 
        base.Add(0, 1); // compliant
    }
 }

Related information

  • SonarC# Version 7.5
@Evangelink Evangelink added Area: Rules Type: False Negative Rule is NOT triggered when it should be. labels Sep 28, 2018
@Evangelink Evangelink added this to the Rules milestone Sep 28, 2018
@valhristov valhristov modified the milestones: Rules, 7.7 Oct 9, 2018
@valhristov valhristov changed the title Fix S4143: FN for Add called on 'this' or 'based' Fix S4143: FN for Add called on 'this' or 'base' Oct 9, 2018
@valhristov valhristov self-assigned this Oct 10, 2018
@valhristov
Copy link
Contributor

There is already a test with this snippet that passes.

@ghost ghost removed the Status: In Progress label Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: False Negative Rule is NOT triggered when it should be.
Projects
None yet
Development

No branches or pull requests

3 participants