mirror of
https://github.com/github/codeql.git
synced 2026-04-25 08:45:14 +02:00
Merge pull request #246 from github/aibaars/tweaks
Add an example snippet query
This commit is contained in:
18
ql/examples/snippets/emptythen.ql
Normal file
18
ql/examples/snippets/emptythen.ql
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @name If statements with empty then branch
|
||||
* @description Finds 'if' statements where the 'then' branch is
|
||||
* an empty block statement
|
||||
* @id ruby/examples/emptythen
|
||||
* @tags if
|
||||
* then
|
||||
* empty
|
||||
* conditional
|
||||
* branch
|
||||
* statement
|
||||
*/
|
||||
|
||||
import ruby
|
||||
|
||||
from IfExpr i
|
||||
where not exists(i.getThen().getAChild())
|
||||
select i
|
||||
Reference in New Issue
Block a user