Skip to content

Commit 35fbaf4

Browse files
committed
C#: Do flag empty if statements if there is a comment in cs/useless-if-statement.
1 parent 361bdfa commit 35fbaf4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

csharp/ql/src/Useless code/FutileConditional.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ predicate emptyStmt(Stmt s) {
1616
or
1717
s =
1818
any(BlockStmt bs |
19-
bs.getNumberOfStmts() = 0
19+
bs.getNumberOfStmts() = 0 and
20+
not any(CommentBlock cb).getParent() = bs
2021
or
2122
bs.getNumberOfStmts() = 1 and
2223
emptyStmt(bs.getStmt(0))

0 commit comments

Comments
 (0)