Skip to content

Potential fix for code scanning alert no. 67: Nested 'if' statements can be combined #974

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

Merged
merged 1 commit into from
Jun 15, 2025

Conversation

vb2ae
Copy link
Member

@vb2ae vb2ae commented Jun 15, 2025

Potential fix for https://github.com/Caliburn-Micro/Caliburn.Micro/security/code-scanning/67

To fix the issue, the nested if statements should be combined into a single if statement using the && operator. This simplifies the code and eliminates unnecessary nesting. The conditions should be enclosed in parentheses to ensure correct operator precedence.

The specific change involves combining the if (withParameters != null) and if (closingParenthesisIndex - openingParenthesisIndex > 1) statements into a single if statement. No additional imports, methods, or definitions are required.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…can be combined

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@vb2ae vb2ae marked this pull request as ready for review June 15, 2025 11:56
@vb2ae vb2ae merged commit 4134c7a into master Jun 15, 2025
4 checks passed
@vb2ae vb2ae deleted the codeql-nested-if branch June 15, 2025 13:04
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.

1 participant