python / python/mypy

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

Open
#21,856 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug topic-error-reporting
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report with the shown main.py example and the mypy --show-column-numbers --show-error-end command, then trace how the ignore-without-code diagnostic is formatted. Done means the diagnostic includes the expected column and error-end values, while the existing output and summary remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.