mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
16 lines
385 B
Plaintext
16 lines
385 B
Plaintext
/**
|
|
* @name Empty 'if' statement
|
|
* @description Finds 'if' statements where the "then" branch is empty and no
|
|
* "else" branch exists.
|
|
* @id swift/examples/empty-if
|
|
* @tags example
|
|
*/
|
|
|
|
import swift
|
|
|
|
from IfStmt ifStmt
|
|
where
|
|
ifStmt.getThen().(BraceStmt).getNumberOfElements() = 0 and
|
|
not exists(ifStmt.getElse())
|
|
select ifStmt, "This 'if' statement is redundant."
|