Skip to content

Commit 810efef

Browse files
committed
Adds python3 test
1 parent e55f01d commit 810efef

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| UseofApply.py:19:3:19:17 | ControlFlowNode for apply() | Call to the obsolete builtin function 'apply'. |
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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])
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Expressions/UseofApply.ql

0 commit comments

Comments
 (0)