Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3ae4cb2 commit 779795bCopy full SHA for 779795b
1 file changed
python/ql/lib/modeling/Util.qll
@@ -6,11 +6,22 @@ private import python
6
private import semmle.python.ApiGraphs
7
private import semmle.python.filters.Tests
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
+
19
/** A class to represent scopes that the user might want to model. */
20
class RelevantScope extends Scope {
21
RelevantScope() {
22
this.isPublic() and
23
not this instanceof TestScope and
24
+ not this.getLocation().getFile() instanceof TestFile and
25
exists(this.getLocation().getFile().getRelativePath())
26
}
27
0 commit comments