@@ -9,11 +9,6 @@ private import codeql.ruby.frameworks.data.ModelsAsData
99private import codeql.ruby.frameworks.data.internal.ApiGraphModelsExtensions
1010private import queries.modeling.internal.Util as Util
1111
12- /** Holds if the given callable is not worth supporting. */
13- private predicate isUninteresting ( DataFlow:: MethodNode c ) {
14- c .getLocation ( ) .getFile ( ) instanceof TestFile
15- }
16-
1712private predicate gemFileStep ( Gem:: GemSpec gem , Folder folder , int n ) {
1813 n = 0 and folder .getAFile ( ) = gem .( File )
1914 or
@@ -63,7 +58,7 @@ abstract class Endpoint instanceof DataFlow::Node {
6358class MethodEndpoint extends Endpoint instanceof DataFlow:: MethodNode {
6459 MethodEndpoint ( ) {
6560 this .isPublic ( ) and
66- not isUninteresting ( this )
61+ this . ( DataFlow :: MethodNode ) . getLocation ( ) . getFile ( ) instanceof Util :: RelevantFile
6762 }
6863
6964 DataFlow:: MethodNode getNode ( ) { result = this }
@@ -144,19 +139,12 @@ class MethodEndpoint extends Endpoint instanceof DataFlow::MethodNode {
144139}
145140
146141string methodClassification ( Call method ) {
147- method .getFile ( ) instanceof TestFile and result = "test"
142+ method .getFile ( ) instanceof Util :: TestFile and result = "test"
148143 or
149- not method .getFile ( ) instanceof TestFile and
144+ not method .getFile ( ) instanceof Util :: TestFile and
150145 result = "source"
151146}
152147
153- class TestFile extends File {
154- TestFile ( ) {
155- this .getRelativePath ( ) .regexpMatch ( ".*(test|spec|examples).+" ) and
156- not this .getAbsolutePath ( ) .matches ( "%/ql/test/%" ) // allows our test cases to work
157- }
158- }
159-
160148/**
161149 * A callable where there exists a MaD sink model that applies to it.
162150 */
@@ -222,7 +210,7 @@ class ModuleEndpoint extends Endpoint {
222210 n order by loc .getFile ( ) .getAbsolutePath ( ) , loc .getStartLine ( ) , loc .getStartColumn ( )
223211 ) and
224212 not moduleNode .( Module ) .isBuiltin ( ) and
225- not moduleNode .getLocation ( ) .getFile ( ) instanceof TestFile
213+ moduleNode .getLocation ( ) .getFile ( ) instanceof Util :: RelevantFile
226214 }
227215
228216 DataFlow:: ModuleNode getNode ( ) { result = moduleNode }
0 commit comments