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 S1643 FN: consider simple assignments with variable not on the innermost add expression #7713

Closed
cristian-ambrosini-sonarsource opened this issue Aug 2, 2023 · 0 comments · Fixed by #7716
Assignees
Labels
Area: C# C# rules related issues. Type: False Negative Rule is NOT triggered when it should be.
Milestone

Comments

@cristian-ambrosini-sonarsource
Copy link
Contributor

Update S1643 to cover simple assignments where the variable is not placed in the innermost add expression. Currently, S1643 only covers cases where the variable is placed at the left side of the innermost add expression:

var s = "";

while (true)
{
    s = s + "a";                     // Noncompliant
    s = s + "a" + "b";           // Noncompliant
    s = s + "a" + "b" + "c";  // Noncompliant 

    s = "a" + "b" + "c" + s;   // FN
    s = "a" + "b" + s;            // FN
    s = "a" + s;                     // FN
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Type: False Negative Rule is NOT triggered when it should be.
Projects
None yet
2 participants