mirror of
https://github.com/github/codeql.git
synced 2026-05-05 21:55:19 +02:00
Merge pull request #2840 from BekaValentine/python-objectapi-to-valueapi-useofapply
Python: ObjectAPI to ValueAPI: UseofApply
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#### UseofApply.ql
|
||||
|
||||
# Use of the builtin function `apply` is generally considered bad now that the
|
||||
# ability to destructure lists of arguments is possible, but we should not flag
|
||||
# cases where the function is merely named `apply` rather than being the actual
|
||||
# builtin `apply` function.
|
||||
|
||||
def useofapply():
|
||||
|
||||
def foo():
|
||||
pass
|
||||
|
||||
|
||||
|
||||
# Positive Cases
|
||||
|
||||
# This use of `apply` is a reference to the builtin function and so SHOULD be
|
||||
# caught by the query.
|
||||
apply(foo, [1])
|
||||
|
||||
|
||||
|
||||
# Negative Cases
|
||||
|
||||
# This use of `apply` is a reference to the locally defined function inside of
|
||||
# `local`, and so SHOULD NOT be caught by the query.
|
||||
def local():
|
||||
def apply(f):
|
||||
pass
|
||||
apply(foo)([1])
|
||||
@@ -0,0 +1 @@
|
||||
Expressions/UseofApply.ql
|
||||
Reference in New Issue
Block a user