mypy --show-error-codes: See Error Codes Inline
mypy --show-error-codes prints the bracketed error code (like [arg-type]) after each message.
Error codes let you write precise ignores and grep logs by category. Recent mypy shows them by default, but the flag still matters for older versions and scripts.
What it does
mypy --show-error-codes appends a code such as [arg-type], [attr-defined], or [import-untyped] to each error line. These codes are what you put in # type: ignore[code] and what --disable-error-code / --enable-error-code reference.
Common usage
mypy --show-error-codes src/
# hide them again if a downstream tool parses plain messages
mypy --hide-error-codes src/
# turn off one category globally
mypy --disable-error-code=import-untyped src/Options
| Flag | What it does |
|---|---|
| --show-error-codes | Append the error code to each message |
| --hide-error-codes | Suppress the codes in output |
| --disable-error-code=<code> | Stop reporting a given code globally |
| --enable-error-code=<code> | Opt into an off-by-default code |
In CI
Keep error codes visible in CI logs so failures are diagnosable and reviewers can copy the code into a targeted ignore. Recent mypy enables codes by default; pass --show-error-codes explicitly if you cannot guarantee the version on every runner.
Common errors in CI
If a teammate cannot reproduce which code to bracket, their mypy may be hiding codes; have them add --show-error-codes. Using --disable-error-code with a misspelled code is silently ignored, so the category keeps firing; copy the exact bracketed code from the output.