You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
--enable-error-code code does not enable some error codes, yet neither are they reported as an invalid error codes #19604
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.
changed the title [-]--enable-error-code unreachable does not enable unreachability analysis, yet neither is it reported as an invalid error code[/-][+]`--enable-error-code unreachable` does not enable unreachability analysis, yet neither is it reported as an invalid error code (etc)[/+]on Aug 7, 2025
Yeah we probably should have the flags enable certain error codes and then solely check those. There are a few flags that meaningfully change mypy's behavior in a way that error codes don't, but that should be limited! (Stuff like strict-optional)
changed the title [-]`--enable-error-code unreachable` does not enable unreachability analysis, yet neither is it reported as an invalid error code (etc)[/-][+]`--enable-error-code code` does not enable some error codes, yet neither are they reported as an invalid error codes[/+]on Oct 1, 2025
Activity
[-]--enable-error-code unreachable does not enable unreachability analysis, yet neither is it reported as an invalid error code[/-][+]`--enable-error-code unreachable` does not enable unreachability analysis, yet neither is it reported as an invalid error code (etc)[/+]wyattscarpenter commentedon Aug 7, 2025
Oh, the same thing is true about
--warn-redundant-casts. And, I suspect, all error codes and flags like this.If they aren't going to have any effect there should be an error message. (But, really, they should just have an effect!)
A5rocks commentedon Aug 30, 2025
Yeah we probably should have the flags enable certain error codes and then solely check those. There are a few flags that meaningfully change mypy's behavior in a way that error codes don't, but that should be limited! (Stuff like
strict-optional)[-]`--enable-error-code unreachable` does not enable unreachability analysis, yet neither is it reported as an invalid error code (etc)[/-][+]`--enable-error-code code` does not enable some error codes, yet neither are they reported as an invalid error codes[/+]