@@ -9,11 +9,6 @@ private import codeql.ruby.frameworks.data.ModelsAsData
9
9
private import codeql.ruby.frameworks.data.internal.ApiGraphModelsExtensions
10
10
private import queries.modeling.internal.Util as Util
11
11
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
-
17
12
private predicate gemFileStep ( Gem:: GemSpec gem , Folder folder , int n ) {
18
13
n = 0 and folder .getAFile ( ) = gem .( File )
19
14
or
@@ -63,7 +58,7 @@ abstract class Endpoint instanceof DataFlow::Node {
63
58
class MethodEndpoint extends Endpoint instanceof DataFlow:: MethodNode {
64
59
MethodEndpoint ( ) {
65
60
this .isPublic ( ) and
66
- not isUninteresting ( this )
61
+ this . ( DataFlow :: MethodNode ) . getLocation ( ) . getFile ( ) instanceof Util :: RelevantFile
67
62
}
68
63
69
64
DataFlow:: MethodNode getNode ( ) { result = this }
@@ -144,19 +139,12 @@ class MethodEndpoint extends Endpoint instanceof DataFlow::MethodNode {
144
139
}
145
140
146
141
string methodClassification ( Call method ) {
147
- method .getFile ( ) instanceof TestFile and result = "test"
142
+ method .getFile ( ) instanceof Util :: TestFile and result = "test"
148
143
or
149
- not method .getFile ( ) instanceof TestFile and
144
+ not method .getFile ( ) instanceof Util :: TestFile and
150
145
result = "source"
151
146
}
152
147
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
-
160
148
/**
161
149
* A callable where there exists a MaD sink model that applies to it.
162
150
*/
@@ -222,7 +210,7 @@ class ModuleEndpoint extends Endpoint {
222
210
n order by loc .getFile ( ) .getAbsolutePath ( ) , loc .getStartLine ( ) , loc .getStartColumn ( )
223
211
) and
224
212
not moduleNode .( Module ) .isBuiltin ( ) and
225
- not moduleNode .getLocation ( ) .getFile ( ) instanceof TestFile
213
+ moduleNode .getLocation ( ) .getFile ( ) instanceof Util :: RelevantFile
226
214
}
227
215
228
216
DataFlow:: ModuleNode getNode ( ) { result = moduleNode }
0 commit comments