python / python/mypy

(🐞) error code that is enabled in the config file can't be disabled on the CLI (with `--disable-error-code`)

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

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

bug topic-configuration
Ngôn ngữ chính
Python
Star
20.6k
Fork
3.3k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

I think it would be intuitive for commandline arguments to override config file options, but the way that enable/disable-error-code works isn't.

pyproject.toml

[tool.mypy]
enable_error_code = "operator"
> mypy --disable-error-code operator -c "1 + ''"
test.py:1: error: Unsupported operand types for + ("int" and "str")  [operator]
Found 1 error in 1 file (checked 1 source file)

The docs specify how these flags interact with themselves, but don't mention the ones in the config file.

--enable-error-code
This flag allows enabling one or multiple error codes globally. See [Error codes](https://mypy.readthedocs.io/en/stable/error_codes.html#error-codes) for more information.

Note: This flag will override disabled error codes from the [--disable-error-code](https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-disable-error-code) flag.

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.

Hướng nghiên cứu

Bắt đầu bằng cách theo dõi cách mypy kết hợp enable_error_code và disable_error_code từ pyproject.toml với các tùy chọn dòng lệnh. Tái hiện ví dụ bằng cách sử dụng --disable-error-code operator, sau đó thêm coverage cho sự kết hợp giữa cấu hình và CLI. Hoàn thành khi tùy chọn CLI suppress mã lỗi đã được cấu hình và tài liệu giải thích mức độ ưu tiên này.

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

Đánh giá

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

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.