(🐞) error code that is enabled in the config file can't be disabled on the CLI (with `--disable-error-code`)
未关闭
还没有人认领这个 Issue。
bug
topic-configuration
- 主要语言
- Python
- 星标
- 20.6k
- 派生
- 3.3k
- 平均合并
- 1 天 18 小时
- 30 天内合并 PR
- 54
描述
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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先追踪 mypy 如何将 pyproject.toml 中的 enable_error_code 和 disable_error_code 与命令行选项结合起来。使用 --disable-error-code operator 重现该示例,然后为配置与 CLI 的组合添加覆盖测试。当 CLI 选项能够抑制已配置的错误代码,并且文档解释了这一优先级时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- devtools
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 50/100