`mypy` does not report column and error end for `ignore-without-code`

Đang mở
#21,856 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
tooling

Hướng nghiên cứu

Tái hiện báo cáo bằng ví dụ main.py được cung cấp và lệnh mypy --show-column-numbers --show-error-end, sau đó theo dõi cách chẩn đoán ignore-without-code được định dạng. Công việc được xem là hoàn tất khi chẩn đoán bao gồm các giá trị cột và error-end như mong đợi, trong khi đầu ra và phần tóm tắt hiện có vẫn chính xác.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug topic-error-reporting

Bug Report

When calling mypy with --show-column-numbers --show-error-end the error end and column are reported.

To Reproduce

# main.py
# mypy: enable-error-code="ignore-without-code"
a: int = "a" # type: ignore
mypy --show-column-numbers --show-error-end main.py

Expected Behavior

Expected the output to contain column and error end numbers:

main.py:3:14:3:27: error: "type: ignore" comment without error code (consider "type: ignore[assignment]" instead)  [ignore-without-code]
Found 1 error in 1 file (checked 1 source file)

The same way it is e.g. if the type ignore is removed in the example:

main.py:3:10:3:12: error: Incompatible types in assignment (expression has type "str", variable has type "int")  [assignment]
Found 1 error in 1 file (checked 1 source file)

Actual Behavior

No column or error end is included, only the line number:

main.py:3: error: "type: ignore" comment without error code (consider "type: ignore[assignment]" instead)  [ignore-without-code]
Found 1 error in 1 file (checked 1 source file)

Calling mypy with only one of the flags results in the same behavior.

Your Environment

  • Mypy version used: 2.3.0 (compiled)
  • Mypy command-line flags: --show-column-numbers --show-error-end
  • Mypy configuration options from mypy.ini (and other config files): no configuration
  • Python version used: 3.14.6 / 3.12.13
Ngôn ngữ chính
Python
Star
20.6k
Fork
3.3k
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
56

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

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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của python/mypy

Tất cả issue của python/mypy

Issue tương tự

Thêm issue về Python

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.