Skip to content

Commit 60a5ef7

Browse files
authored
Merge pull request github#13319 from aibaars/print-cfg
Ruby: add print-cfg query
2 parents 6ba8f9e + d91fa2d commit 60a5ef7

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* @name Print CFG
3+
* @description Produces a representation of a file's Control Flow Graph.
4+
* This query is used by the VS Code extension.
5+
* @id rb/print-cfg
6+
* @kind graph
7+
* @tags ide-contextual-queries/print-cfg
8+
*/
9+
10+
private import codeql.ruby.controlflow.internal.ControlFlowGraphImplShared::TestOutput
11+
private import codeql.IDEContextual
12+
13+
/**
14+
* Gets the source file to generate a CFG from.
15+
*/
16+
external string selectedSourceFile();
17+
18+
class MyRelevantNode extends RelevantNode {
19+
MyRelevantNode() {
20+
this.getScope().getLocation().getFile() = getFileBySourceArchiveName(selectedSourceFile())
21+
}
22+
}

0 commit comments

Comments
 (0)