Python: more tests and comments

This commit is contained in:
Rasmus Lerchedahl Petersen
2021-09-08 14:44:36 +02:00
parent 9b198c6d0a
commit a9c409403c
5 changed files with 112 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
// This query should be more focused yet.
import python
import semmle.python.dataflow.new.DataFlow
pragma[inline]
predicate inCodebase(DataFlow::Node node) { exists(node.getLocation().getFile().getRelativePath()) }
predicate isTopLevel(DataFlow::Node node) { node.getScope() instanceof Module }
predicate inFocus(DataFlow::Node node) {
isTopLevel(node) and
inCodebase(node)
}
from DataFlow::Node nodeFrom, DataFlow::Node nodeTo
where
inFocus(nodeFrom) and
inFocus(nodeTo) and
DataFlow::localFlowStep(nodeFrom, nodeTo)
select nodeFrom, nodeTo