mirror of
https://github.com/github/codeql.git
synced 2026-05-02 04:05:14 +02:00
Merge pull request #1840 from markshannon/python-better-hasattribute-handling
Python: Add 'hasAttribute' predicate to ObjectInternal and Value.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
| decorated_exports.py:3:33:3:45 | Str | The name 'not_defined' is exported by __all__ but is not defined. |
|
||||
| exports.py:1:57:1:64 | Str | The name 'nosuch' is exported by __all__ but is not defined. |
|
||||
@@ -0,0 +1 @@
|
||||
Variables/UndefinedExport.ql
|
||||
@@ -4,3 +4,5 @@
|
||||
| UndefinedGlobal.py:123:5:123:7 | ug3 | This use of global variable 'ug3' may be undefined. |
|
||||
| UninitializedLocal.py:5:13:5:15 | ug1 | This use of global variable 'ug1' may be undefined. |
|
||||
| UninitializedLocal.py:22:9:22:11 | ug1 | This use of global variable 'ug1' may be undefined. |
|
||||
| decorated_exports.py:10:2:10:19 | undotted_decorator | This use of global variable 'undotted_decorator' may be undefined. |
|
||||
| decorated_exports.py:14:2:14:13 | not_imported | This use of global variable 'not_imported' may be undefined. |
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import dotted
|
||||
|
||||
__all__ = ["foo", "bar", "baz", "not_defined"]
|
||||
|
||||
|
||||
@dotted.decorator
|
||||
def foo():
|
||||
pass
|
||||
|
||||
@undotted_decorator
|
||||
def bar():
|
||||
pass
|
||||
|
||||
@not_imported.but_dotted
|
||||
def baz():
|
||||
pass
|
||||
19
python/ql/test/query-tests/Variables/undefined/exports.py
Normal file
19
python/ql/test/query-tests/Variables/undefined/exports.py
Normal file
@@ -0,0 +1,19 @@
|
||||
__all__ = ["foo", "bar", "baz", "quux", "blat", "frob", "nosuch", "i_got_it_elsewhere"]
|
||||
|
||||
with open("foo.txt") as f:
|
||||
foo = f.read()
|
||||
|
||||
b = open("bar.txt")
|
||||
bar = b.read()
|
||||
|
||||
baz = open("baz.txt")
|
||||
|
||||
from unknown_module import unknown_value
|
||||
|
||||
quux = 5 + unknown_value
|
||||
|
||||
blat = str(5)
|
||||
|
||||
frob = "5"
|
||||
|
||||
from unknown_module import i_got_it_elsewhere
|
||||
@@ -0,0 +1,3 @@
|
||||
__all__ = ["foo"]
|
||||
|
||||
from unknown_module import *
|
||||
Reference in New Issue
Block a user