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 S1144 FP: Ignore unused Deconstruct methods #9470

Merged
merged 3 commits into from
Jun 28, 2024

Conversation

sebastien-marichal
Copy link
Contributor

@sebastien-marichal sebastien-marichal commented Jun 26, 2024

Fixes #3842

To merge after #9459

S1144 will now ignore unused Deconstruct methods.
It ignores methods named Deconstruct with at least 1 parameter and when all parameters have the out reference keyword.

@sebastien-marichal sebastien-marichal linked an issue Jun 26, 2024 that may be closed by this pull request
Base automatically changed from sma/s1144-sender to master June 27, 2024 12:04
}

private class Ambiguous
{
public void Deconstruct(out string a, out string b, out string c) { a = b = c = null; }
public void Deconstruct(out object a, out object b, out object c) { a = b = c = null; } // Noncompliant FP, actually the one above is not used
public void Deconstruct(out object a, out object b, out object c) { a = b = c = null; } // Compliant, Deconstruct methods are ignored FP, actually the one above is not used
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public void Deconstruct(out object a, out object b, out object c) { a = b = c = null; } // Compliant, Deconstruct methods are ignored FP, actually the one above is not used
public void Deconstruct(out object a, out object b, out object c) { a = b = c = null; } // Compliant, Deconstruct methods are ignored

Copy link
Contributor

@mary-georgiou-sonarsource mary-georgiou-sonarsource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - minor comment

@sebastien-marichal sebastien-marichal marked this pull request as ready for review June 27, 2024 12:18
@sebastien-marichal sebastien-marichal enabled auto-merge (squash) June 27, 2024 12:21
Copy link

Copy link

@sebastien-marichal sebastien-marichal merged commit fde87c8 into master Jun 28, 2024
27 checks passed
@sebastien-marichal sebastien-marichal deleted the sma/s1144-deconstruct branch June 28, 2024 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix S1144 FP: Ignore unused Deconstruct methods
2 participants