Skip to content

--enable-error-code unreachable does not enable unreachability analysis, yet neither is it reported as an invalid error code (etc) #19604

@wyattscarpenter

Description

@wyattscarpenter

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-configurationConfiguration files and flags

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions