We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Product and Version Used: Roslynator.Analyzers 4.12.2
Steps to Reproduce: Following code or similar one containing if statement with multiple conditions, but without any nesting:
private void Foo(string bar, int baz) { if (bar == "bar" && baz == 123) // RCS1208: Reduce 'if' nesting { var foo = "baz"; } }
Please note, that the issue doesn't occur, when there is some other code present after if statement in question:
private void Foo(string bar, int baz) { if (bar == "bar" && baz == 123) { var foo = "baz"; } var thisDoes = "something preventing RCS1208 in if statement above"; }
Actual Behavior:
RCS1208 is raised, suggesting rather counterproductive change to:
private void Foo(string bar, int baz) { if (bar != "bar" || baz != 123) { return; } var foo = "baz"; }
Expected Behavior: Do not raise RCS1208 in case of flat if statements with multiple conditions.
The text was updated successfully, but these errors were encountered:
Also facing false positive, this triggers the analyzer:
if (last.End > time) { return last; } return null;
but if the if is inverted:
if (last.End <= time) { return null; } return last;
then it's fine
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Product and Version Used:
Roslynator.Analyzers 4.12.2
Steps to Reproduce:
Following code or similar one containing if statement with multiple conditions, but without any nesting:
Please note, that the issue doesn't occur, when there is some other code present after if statement in question:
Actual Behavior:
RCS1208 is raised, suggesting rather counterproductive change to:
Expected Behavior:
Do not raise RCS1208 in case of flat if statements with multiple conditions.
The text was updated successfully, but these errors were encountered: