github / github/codeql

LGTM.com - false positive when using imports with TYPE_CHECKING

Đang mở
#4,258 2 bình luận 1 reaction 0 người được giao Xem trên GitHub
false-positive Python
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

**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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.