`mypy` does not report column and error end for `ignore-without-code`
还没有人认领这个 Issue。
评估
调研方向
使用所示的 main.py 示例和 mypy --show-column-numbers --show-error-end 命令重现该报告,然后跟踪 ignore-without-code 诊断的格式化方式。当诊断包含预期的列和 error-end 值,同时现有输出和摘要仍然正确时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- Python
- 星标
- 20.6k
- 派生
- 3.3k
- 平均合并
- 1 天 3 小时
- 30 天内合并 PR
- 59
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python/mypy 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
-
documentation
难度 2/5 1-3 小时 新手友好度 72/100
-
bug topic-configuration topic-error-reporting
难度 2/5 1-3 小时 新手友好度 68/100
-
bug topic-attrs
难度 2/5 1-3 小时 新手友好度 62/100
相似的 Issue
-
area: harness bug status: needs-triage
难度 2/5 1-3 小时 新手友好度 75/100
Human-Agent-Society/reef#625 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 1/5 1 小时以内 新手友好度 80/100
learningequality/kolibri#15351 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
Name consistency 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
eellak/triplestore#65 · 1 条评论 ·