`--enable-error-code code` does not enable some error codes, yet neither are they reported as an invalid error codes
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
In my understanding, --enable-error-code unreachable should have the same effect as --warn-unreachable. But, instead, it seems to have no effect, and doesn't even produce an error.
$uvx mypy -c "if False: print('hello')"
Success: no issues found in 1 source file
$uvx mypy -c "if False: print('hello')" --warn-unreachable
<string>:1: error: Statement is unreachable [unreachable]
Found 1 error in 1 file (checked 1 source file)
$uvx mypy -c "if False: print('hello')" --enable-error-code unreachable
Success: no issues found in 1 source file
$uvx mypy -c "if False: print('hello')" --enable-error-code unreachable --warn-unreachable
<string>:1: error: Statement is unreachable [unreachable]
Found 1 error in 1 file (checked 1 source file)
$uvx mypy -c "if False: print('hello')" --enable-error-code funnyerrorcodenotreal
usage: mypy [-h] [-v] [-V] [more options; see below]
[-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files ...]
mypy: error: Invalid error code(s): funnyerrorcodenotreal
Based on my testing, this seems to have been the case since 1.0.0 and maybe before, and thus is not a recent regression.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the mypy command-line handling for --enable-error-code and --warn-unreachable, using the reproducer in the issue as the first check. Compare the behavior for unreachable with an invalid code, then add or update focused command-line tests so enabling unreachable works without --warn-unreachable while invalid codes remain rejected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100