File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,22 @@ private import python
6
6
private import semmle.python.ApiGraphs
7
7
private import semmle.python.filters.Tests
8
8
9
+ /**
10
+ * A file that probably contains tests.
11
+ */
12
+ class TestFile extends File {
13
+ TestFile ( ) {
14
+ this .getRelativePath ( ) .regexpMatch ( ".*(test|spec|examples).+" ) and
15
+ not this .getAbsolutePath ( ) .matches ( "%/ql/test/%" ) // allows our test cases to work
16
+ }
17
+ }
18
+
9
19
/** A class to represent scopes that the user might want to model. */
10
20
class RelevantScope extends Scope {
11
21
RelevantScope ( ) {
12
22
this .isPublic ( ) and
13
23
not this instanceof TestScope and
24
+ not this .getLocation ( ) .getFile ( ) instanceof TestFile and
14
25
exists ( this .getLocation ( ) .getFile ( ) .getRelativePath ( ) )
15
26
}
16
27
}
You can’t perform that action at this time.
0 commit comments