File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
python/ql/test/experimental/dataflow/TestUtil Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ import python
2+ import experimental.dataflow.TestUtil.FlowTest
3+ private import semmle.python.dataflow.new.internal.PrintNode
4+
5+ class DataFlowQueryTest extends FlowTest {
6+ DataFlowQueryTest ( ) { this = "DataFlowQueryTest" }
7+
8+ override string flowTag ( ) { result = "flow" }
9+
10+ override predicate relevantFlow ( DataFlow:: Node source , DataFlow:: Node sink ) {
11+ exists ( DataFlow:: Configuration cfg | cfg .hasFlow ( source , sink ) )
12+ }
13+ }
14+
15+ query predicate missingAnnotationOnSink ( Location location , string error , string element ) {
16+ error = "ERROR, you should add `# $ MISSING: flow` annotation" and
17+ exists ( DataFlow:: Node sink |
18+ exists ( DataFlow:: Configuration cfg | cfg .isSink ( sink ) ) and
19+ location = sink .getLocation ( ) and
20+ element = prettyExpr ( sink .asExpr ( ) ) and
21+ not any ( DataFlow:: Configuration config ) .hasFlow ( _, sink ) and
22+ not exists ( FalseNegativeExpectation missingResult |
23+ missingResult .getTag ( ) = "flow" and
24+ missingResult .getLocation ( ) .getFile ( ) = location .getFile ( ) and
25+ missingResult .getLocation ( ) .getStartLine ( ) = location .getStartLine ( )
26+ )
27+ )
28+ }
You can’t perform that action at this time.
0 commit comments