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 S2234 FN: lambdas #8072

Open
antonioaversa opened this issue Sep 26, 2023 · 0 comments
Open

Fix S2234 FN: lambdas #8072

antonioaversa opened this issue Sep 26, 2023 · 0 comments
Labels
Area: C# C# rules related issues. Area: VB.NET VB.NET rules related issues. Type: False Negative Rule is NOT triggered when it should be.

Comments

@antonioaversa
Copy link
Contributor

antonioaversa commented Sep 26, 2023

The current implementation of S2234 doesn't take into lambdas,

var f = (int a, int b) => a + b;
var g = (int a, int b) => f(b, a); // FN

There are multiple scenarios in which false negatives are produced:

  • lambda calling another lambda
  • method calling a lambda
  • local function calling a lambda
  • partial inversion of arguments
  • total inversion of arguments

Default lambda parameters, from C#12, should be tested as well.

Related issues:

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. Area: VB.NET VB.NET rules related issues. Type: False Negative Rule is NOT triggered when it should be.
Projects
None yet
Development

No branches or pull requests

3 participants