Open
Description
It's pretty common to see functions like this:
def foo(x: str):
...
return <something>
Note that the function foo
has an implicit Any
return type, which is likely not what the programmer intended.
Add a new error code (disabled by default since this is a backward compatibility break) that generates an error about a missing return type if at least one argument has an explicit type annotation. The error could be something like 'Function "foo" has no return type annotation', and perhaps add a note suggesting the use of -> None
if the function never returns a value.
We might eventually enable the error code by default as part of a major mypy release, such as 2.0 or 3.0.