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

S3900 FP: Ignore parameters with assigned values #6972

Closed
zsolt-kolbay-sonarsource opened this issue Mar 22, 2023 · 0 comments · Fixed by #7044 or #7039
Closed

S3900 FP: Ignore parameters with assigned values #6972

zsolt-kolbay-sonarsource opened this issue Mar 22, 2023 · 0 comments · Fixed by #7044 or #7039
Assignees
Labels
Area: C# C# rules related issues. Type: False Positive Rule IS triggered when it shouldn't be.
Milestone

Comments

@zsolt-kolbay-sonarsource
Copy link
Contributor

zsolt-kolbay-sonarsource commented Mar 22, 2023

Method parameters which are assigned a new value inside the method should be ignored by the S3900 rule:

public class MyClass
{
   public void Method(object o) 
   {
       o = Create();
       o.ToString();
   }

   private void Create() => new object();
}

This should apply to simple assignments (ref parameters and other types of assignments will be handled in a different issue).

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 Positive Rule IS triggered when it shouldn't be.
Projects
None yet
4 participants