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
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.pydefexample():
a: int=1print(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.
Is there any way to make warnings fail if we wanted that? My team finds the annotation-unchecked useful but our CI builds continue to pass so we often miss the warnings and end up committing typed code that doesn't get checked.
Is there any way to make warnings fail if we wanted that?
I don't think there is a way, but I see how such a flag for mypy may be useful. I would suggest you open a separate issue for this. In the meantime I guess you can write a bash wrapper script that fails if mypy shows some notes.
Bug Report
When the code triggers
annotation-unchecked
warnings, bothmypy
anddmypy
print a green "success" line. However there's an unexpected difference between exit codes. Mypy exits with0
as expected in a successful check, but dmypy exits with a1
. This prevents me from using dmypy in automated scenarios.To Reproduce
Expected Behavior
Successful runs should return zero exit code in both mypy and dmypy.
Environment
A fresh venv with latest mypy installed, no configuration files at all.
The text was updated successfully, but these errors were encountered: