close
The Wayback Machine - https://web.archive.org/web/20260330054221/https://github.com/github/codeql/issues/4258
Skip to content

LGTM.com - false positive when using imports with TYPE_CHECKING #4258

@david-zwicker

Description

@david-zwicker

Description of the false positive

lgtm complains that a "Module is imported more than once" in my python code, but the first import ist protected by "if TYPE_CHECKING:", which is required for mypy type checking to work properly. I think lgtm should simply ignore imports that are under TYPE_CHECKING.

URL to the alert on the project page on LGTM.com

Here is the concrete error:
https://lgtm.com/projects/g/zwicker-group/py-pde/snapshot/67363039e04aebcfba93b01fcf65014bec37aebb/files/pde/tools/plotting.py?sort=name&dir=ASC&mode=heatmap#x70f271ca0359e14c:1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions