Skip to content

Commit df4fb23

Browse files
authored
Merge pull request #246 from github/aibaars/tweaks
Add an example snippet query
2 parents 50cfd9c + 9b877dc commit df4fb23

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

ql/examples/snippets/emptythen.ql

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @name If statements with empty then branch
3+
* @description Finds 'if' statements where the 'then' branch is
4+
* an empty block statement
5+
* @id ruby/examples/emptythen
6+
* @tags if
7+
* then
8+
* empty
9+
* conditional
10+
* branch
11+
* statement
12+
*/
13+
14+
import ruby
15+
16+
from IfExpr i
17+
where not exists(i.getThen().getAChild())
18+
select i

0 commit comments

Comments
 (0)