Files
codeql/csharp/ql/src/Language Abuse/NestedIf.ql
2025-06-17 09:56:43 +02:00

22 lines
562 B
Plaintext

/**
* @name Nested 'if' statements can be combined
* @description Nested 'if' statements can be simplified by combining them using '&&'.
* @kind problem
* @problem.severity recommendation
* @precision high
* @id cs/nested-if-statements
* @tags quality
* maintainability
* readability
* language-features
*/
import csharp
from IfStmt outer, IfStmt inner
where
inner = outer.getThen().stripSingletonBlocks() and
not exists(outer.getElse()) and
not exists(inner.getElse())
select outer, "These 'if' statements can be combined."