mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Will need subsequent PRs fixing up test failures (due to deprecated methods moving around), but other than that everything should be straight-forward.
22 lines
394 B
Plaintext
22 lines
394 B
Plaintext
/**
|
|
* @id py/examples/emptythen
|
|
* @name If statements with empty then branch
|
|
* @description Finds 'if' statements where the "then" branch
|
|
* consists entirely of Pass statements
|
|
* @tags if
|
|
* then
|
|
* empty
|
|
* conditional
|
|
* branch
|
|
*/
|
|
|
|
import python
|
|
|
|
from If i
|
|
where
|
|
not exists(Stmt s |
|
|
i.getStmt(_) = s and
|
|
not s instanceof Pass
|
|
)
|
|
select i
|