mirror of
https://github.com/github/codeql.git
synced 2025-12-20 18:56:32 +01:00
Python: Ignore from foo import * when foo is absent.
This commit is contained in:
@@ -26,7 +26,7 @@ predicate all_defined(ModuleValue exporter) {
|
||||
}
|
||||
|
||||
from ImportStar imp, ModuleValue exporter
|
||||
where import_star(imp, exporter) and not all_defined(exporter)
|
||||
where import_star(imp, exporter) and not all_defined(exporter) and not exporter.isAbsent()
|
||||
select imp,
|
||||
"Import pollutes the enclosing namespace, as the imported module $@ does not define '__all__'.",
|
||||
exporter, exporter.getName()
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
| imports_test.py:22:1:22:32 | from module_without_all import * | Import pollutes the enclosing namespace, as the imported module $@ does not define '__all__'. | module_without_all.py:0:0:0:0 | Module module_without_all | module_without_all |
|
||||
| imports_test.py:65:1:65:40 | from module_that_does_not_exist import * | Import pollutes the enclosing namespace, as the imported module $@ does not define '__all__'. | file://:0:0:0:0 | Missing module module_that_does_not_exist | module_that_does_not_exist |
|
||||
|
||||
Reference in New Issue
Block a user