Skip to content

undefined-local-with-import-star-usage

Pythonsuspiciousno fixdefault: off

Reports a name that no scope binds in a file that has a star import.

With from m import * the names it brings in are not visible to a reader or a tool, so a name that is defined nowhere in the file may come from the import or may be a misspelling. The same file without the star import would be reported as undefined.

To fix, import the names that are used, or define them.

Reported
...
__all__ = ["present", "from_star"]
present = 1
print(undefined, present, len)
def nested():
...
def f(a: "Missing"):
x: int
...
python:
lint:
rules:
undefined-local-with-import-star-usage: warn # off (default), warn, error

Suppress one line with sudsy-disable-next-line undefined-local-with-import-star-usage in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
ruff F405 full