Skip to content

Commit 4713ba1

Browse files
committed
python: more results no longer missing
Adjusted `tracked.ql` - no need to annotate results on line 0 this could happen for global SSA variables - no need to annotate scope entry definitons they look a bit weird, as the annotation goes on the line of the function definition.
1 parent 2318752 commit 4713ba1

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

python/ql/test/experimental/dataflow/coverage/test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -726,15 +726,15 @@ def f6(arg):
726726
return f5(arg)
727727

728728
x = f6(SOURCE)
729-
SINK(x) #$ MISSING:flow="SOURCE, l:-1 -> x"
729+
SINK(x) #$ flow="SOURCE, l:-1 -> x"
730730
x = f5(SOURCE)
731-
SINK(x) #$ MISSING:flow="SOURCE, l:-1 -> x"
731+
SINK(x) #$ flow="SOURCE, l:-1 -> x"
732732
x = f4(SOURCE)
733-
SINK(x) #$ MISSING:flow="SOURCE, l:-1 -> x"
733+
SINK(x) #$ flow="SOURCE, l:-1 -> x"
734734
x = f3(SOURCE)
735-
SINK(x) #$ MISSING:flow="SOURCE, l:-1 -> x"
735+
SINK(x) #$ flow="SOURCE, l:-1 -> x"
736736
x = f2(SOURCE)
737-
SINK(x) #$ MISSING:flow="SOURCE, l:-1 -> x"
737+
SINK(x) #$ flow="SOURCE, l:-1 -> x"
738738
x = f1(SOURCE)
739739
SINK(x) #$ flow="SOURCE, l:-1 -> x"
740740

python/ql/test/experimental/dataflow/typetracking/moduleattr.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ module_attr_tracker
66
| import_as_attr.py:1:28:1:35 | GSSA Variable attr_ref |
77
| import_as_attr.py:3:1:3:1 | GSSA Variable x |
88
| import_as_attr.py:3:5:3:12 | ControlFlowNode for attr_ref |
9+
| import_as_attr.py:5:1:5:10 | GSSA Variable attr_ref |
910
| import_as_attr.py:6:5:6:5 | SSA variable y |
1011
| import_as_attr.py:6:9:6:16 | ControlFlowNode for attr_ref |

python/ql/test/experimental/dataflow/typetracking/test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ def test_import():
6060
def to_inner_scope():
6161
x = tracked # $tracked
6262
def foo():
63-
y = x # $ MISSING: tracked
64-
return y # $ MISSING: tracked
65-
also_x = foo() # $ MISSING: tracked
66-
print(also_x) # $ MISSING: tracked
63+
y = x # $ tracked
64+
return y # $ tracked
65+
also_x = foo() # $ tracked
66+
print(also_x) # $ tracked
6767

6868
# ------------------------------------------------------------------------------
6969
# Function decorator

python/ql/test/experimental/dataflow/typetracking/tracked.ql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ class TrackedTest extends InlineExpectationsTest {
2424
tracked(t).flowsTo(e) and
2525
// Module variables have no sensible location, and hence can't be annotated.
2626
not e instanceof DataFlow::ModuleVariableNode and
27+
// Global variables on line 0 also cannot be annotated
28+
not e.getLocation().getStartLine() = 0 and
29+
// We do not wish to annotate scope entry definitions,
30+
// as they do not appear in the source code.
31+
not e.asVar() instanceof ScopeEntryDefinition and
2732
tag = "tracked" and
2833
location = e.getLocation() and
2934
value = t.getAttr() and

0 commit comments

Comments
 (0)