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
66private import semmle.python.ApiGraphs
77private import semmle.python.filters.Tests
88
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+
919/** A class to represent scopes that the user might want to model. */
1020class RelevantScope extends Scope {
1121 RelevantScope ( ) {
1222 this .isPublic ( ) and
1323 not this instanceof TestScope and
24+ not this .getLocation ( ) .getFile ( ) instanceof TestFile and
1425 exists ( this .getLocation ( ) .getFile ( ) .getRelativePath ( ) )
1526 }
1627}
You can’t perform that action at this time.
0 commit comments