Skip to content

Unchecked annotation note causes dmypy to exit with code 1 on a successful run #14101

Closed
@vtclose

Description

@vtclose

Bug Report

When the code triggers annotation-unchecked warnings, both mypy and dmypy print a green "success" line. However there's an unexpected difference between exit codes. Mypy exits with 0 as expected in a successful check, but dmypy exits with a 1. This prevents me from using dmypy in automated scenarios.

To Reproduce

# example.py
def example():
    a: int = 1
    print(a + "2")
$ mypy example.py; echo $?
example.py:2: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
Success: no issues found in 1 source file
0 # Good, expected

$ dmypy run example.py; echo $?
Daemon started
example.py:2: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
Success: no issues found in 44 source files
1 # Bad, unexpected

Expected Behavior

Successful runs should return zero exit code in both mypy and dmypy.

Environment

$ python -V
Python 3.10.8
$ mypy -V
mypy 0.991 (compiled: yes)

A fresh venv with latest mypy installed, no configuration files at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions