@@ -18,7 +18,7 @@ library by beginning your query with:
18
18
19
19
.. code-block :: ql
20
20
21
- import ruby
21
+ import codeql. ruby.AST
22
22
23
23
The CodeQL libraries model various aspects of Ruby code, depending on the type of query you want to write.
24
24
For example the abstract syntax tree (AST) library is used for locating program elements, to match syntactic
@@ -138,7 +138,7 @@ The following example lists all methods in the class `ApiController`:
138
138
139
139
.. code-block :: ql
140
140
141
- import ruby
141
+ import codeql. ruby.AST
142
142
143
143
from ClassDeclaration m
144
144
where m.getName() = "ApiController"
@@ -223,7 +223,7 @@ Example
223
223
224
224
.. code-block :: ql
225
225
226
- import ruby
226
+ import codeql. ruby.AST
227
227
228
228
from Method m
229
229
where m.getName() = "show"
@@ -274,7 +274,7 @@ The following example finds all literals that are returned by a `return` stateme
274
274
275
275
.. code-block :: ql
276
276
277
- import ruby
277
+ import codeql. ruby.AST
278
278
279
279
from ReturnStmt return, Literal lit
280
280
where lit.getParent() = return
@@ -421,7 +421,7 @@ The following example finds "chained assignments" (of the form ``A=B=C``):
421
421
422
422
.. code-block :: ql
423
423
424
- import ruby
424
+ import codeql. ruby.AST
425
425
426
426
from Assignment op
427
427
where op.getRightOperand() instanceof Assignment
@@ -460,7 +460,7 @@ The following example finds all method calls to a method called `delete`.
460
460
461
461
.. code-block :: ql
462
462
463
- import ruby
463
+ import codeql. ruby.AST
464
464
465
465
from MethodCall call
466
466
where call.getMethodName() = "delete"
@@ -517,7 +517,7 @@ The following example finds `if`-expressions that are missing a `then` branch.
517
517
518
518
.. code-block :: ql
519
519
520
- import ruby
520
+ import codeql. ruby.AST
521
521
522
522
from IfExpr expr
523
523
where not exists(expr.getThen())
@@ -559,7 +559,7 @@ The following example finds all class variables in the class `StaticController`:
559
559
560
560
.. code-block :: ql
561
561
562
- import ruby
562
+ import codeql. ruby.AST
563
563
564
564
from ClassDeclaration cd, ClassVariable v
565
565
where
@@ -612,7 +612,7 @@ The following example finds writes to class variables in the class `StaticContro
612
612
613
613
.. code-block :: ql
614
614
615
- import ruby
615
+ import codeql. ruby.AST
616
616
617
617
from ClassVariableWriteAccess write, ClassDeclaration cd, ClassVariable v
618
618
where
0 commit comments