Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disallow-untyped-defs vs disallow_incomplete_defs doc inconsistency #9963

Closed
ravwojdyla opened this issue Jan 25, 2021 · 3 comments · Fixed by #15247
Closed

disallow-untyped-defs vs disallow_incomplete_defs doc inconsistency #9963

ravwojdyla opened this issue Jan 25, 2021 · 3 comments · Fixed by #15247

Comments

@ravwojdyla
Copy link

https://mypy.readthedocs.io/en/stable/config_file.html#confval-disallow_untyped_defs says:

Disallows defining functions without type annotations or with incomplete type annotations.

Notice the extra or with incomplete type annotations.

and https://mypy.readthedocs.io/en/stable/config_file.html#confval-disallow_incomplete_defs says:

Disallows defining functions with incomplete type annotations.

While https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-disallow-untyped-defs says:

This flag reports an error whenever it encounters a function definition without type annotations.

and https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-disallow-incomplete-defs says:

This flag reports an error whenever it encounters a partly annotated function definition.

I believe the version from command_line doc is the correct one, and config_file doc should be updated.

@JukkaL
Copy link
Collaborator

JukkaL commented Feb 11, 2021

The config file docs seems correct. Let's assume t.py has a partially annotated function:

def f(x, y: int) -> str: pass

Now this is what I get:

$ mypy --disallow-untyped-defs t.py
t.py:1: error: Function is missing a type annotation for one or more arguments

@ravwojdyla
Copy link
Author

👋 @JukkaL there is some inconsistency in this doc for sure, let's try to get to the bottom of that. Is this the expected behaviour:

➜  test_mypy cat t.py
def f(x, y: int) -> str: pass

➜  test_mypy mypy --disallow-untyped-defs --allow-incomplete-defs  t.py
t.py:1: error: Function is missing a type annotation for one or more arguments
Found 1 error in 1 file (checked 1 source file)

(➜  test_mypy mypy --allow-untyped-defs --allow-incomplete-defs  t.py
Success: no issues found in 1 source file

➜  test_mypy mypy --allow-untyped-defs --disallow-incomplete-defs  t.py
t.py:1: error: Function is missing a type annotation for one or more arguments
Found 1 error in 1 file (checked 1 source file)

➜  test_mypy mypy --disallow-untyped-defs --disallow-incomplete-defs  t.py
t.py:1: error: Function is missing a type annotation for one or more arguments
Found 1 error in 1 file (checked 1 source file)

@hauntsaninja
Copy link
Collaborator

The difference between the two is what they would do on def f(x, y): ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants