mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
Python: Fix FPs for py/import-own-module
Before I added `--max-import-depth=2`, there was a bit of trouble, where it would alert on `from pkg_ok import foo2` -- since all the `pkg_ok.foo<n>` modules were missing, I guess the analysis didn't make any assumptions on whether `foo2` is a module or a regular attribute.
This commit is contained in:
@@ -14,7 +14,12 @@ import python
|
||||
|
||||
predicate modules_imports_itself(Import i, ModuleValue m) {
|
||||
i.getEnclosingModule() = m.getScope() and
|
||||
m.importedAs(i.getAnImportedModuleName())
|
||||
m = max(string s, ModuleValue m_ |
|
||||
s = i.getAnImportedModuleName() and
|
||||
m_.importedAs(s)
|
||||
|
|
||||
m_ order by s.length()
|
||||
)
|
||||
}
|
||||
|
||||
from Import i, ModuleValue m
|
||||
|
||||
Reference in New Issue
Block a user