File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed
python/ql/test/3/query-tests/Expressions/UseofApply Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ | UseofApply.py:19:3:19:17 | ControlFlowNode for apply() | Call to the obsolete builtin function 'apply'. |
Original file line number Diff line number Diff line change
1
+ #### UseofApply.ql
2
+
3
+ # Use of the builtin function `apply` is generally considered bad now that the
4
+ # ability to destructure lists of arguments is possible, but we should not flag
5
+ # cases where the function is merely named `apply` rather than being the actual
6
+ # builtin `apply` function.
7
+
8
+ def useofapply ():
9
+
10
+ def foo ():
11
+ pass
12
+
13
+
14
+
15
+ # Positive Cases
16
+
17
+ # This use of `apply` is a reference to the builtin function and so SHOULD be
18
+ # caught by the query.
19
+ apply (foo , [1 ])
20
+
21
+
22
+
23
+ # Negative Cases
24
+
25
+ # This use of `apply` is a reference to the locally defined function inside of
26
+ # `local`, and so SHOULD NOT be caught by the query.
27
+ def local ():
28
+ def apply (f ):
29
+ pass
30
+ apply (foo )([1 ])
Original file line number Diff line number Diff line change
1
+ Expressions/UseofApply.ql
You can’t perform that action at this time.
0 commit comments