Skip to content

Commit b2431d0

Browse files
committed
Ruby: exclude 'require' and 'require_relative' definitions from call graph
The syntax_suggest library redefines Kernel.require/require_relative. Somehow this causes performance issues on ruby/ruby. As a workaround we exclude 'require' and 'require_relative'.
1 parent 7dc5bda commit b2431d0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ruby/ql/lib/codeql/ruby/ast/internal/Module.qll

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,14 @@ private module Cached {
137137
}
138138

139139
cached
140-
Method lookupMethod(Module m, string name) { TMethod(result) = lookupMethodOrConst(m, name) }
140+
Method lookupMethod(Module m, string name) {
141+
// The syntax_suggest library redefines Kernel.require/require_relative.
142+
// Somehow this causes performance issues on ruby/ruby. As a workaround
143+
// we exclude 'require' and 'require_relative'.
144+
// TODO: find the actual cause of the slowdown and fix things properly.
145+
not name = ["require", "require_relative"] and
146+
TMethod(result) = lookupMethodOrConst(m, name)
147+
}
141148

142149
cached
143150
Expr lookupConst(Module m, string name) {

0 commit comments

Comments
 (0)