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-incomplete-defs does not print errors when run without this argument previously #4913

Closed
srittau opened this issue Apr 15, 2018 · 6 comments
Labels

Comments

@srittau
Copy link
Contributor

srittau commented Apr 15, 2018

I have a fairly large project that is partly type-checked. Using the following mypy.ini file it typechecks without errors:

[mypy]
ignore_missing_imports = True
; disallow_subclassing_any = True
check_untyped_defs = True
; disallow_untyped_defs = True
; disallow_incomplete_defs = True
warn_redundant_casts = True
; warn_return_any = True
warn_unused_ignores = True
warn_unused_configs = True
strict_optional = True

Running it with --disallow-incomplete-defs or --disallow-untyped-defs still produces lots of warnings.

Since upgrading to mypy 0.590, running mypy, followed by mypy --disallow-incomplete-defs will not output any warnings, although the latter command should produce loads. mypy --disallow-untyped-defs on the other hand still works. When running mypy --disallow-incomplete-defs after removing .mypy_cache or after mypy --disallow-untyped-defs, it will again print the warnings, until the next time mypy is run without arguments. --no-incremental also works around this problem.

I tried to create a minimal test case with just one file exhibiting that problem, but unfortunately that worked correctly.

I tested it with Python 3.5.5.

@ilevkivskyi
Copy link
Member

ilevkivskyi commented Apr 15, 2018

This is likely caused by the switch to incremental mode by default (may be a problem with import cycles). As a temporary workaround you can use --no-incremental on 0.590, but since this is a regression, I think this is high priority to fix.

@srittau
Copy link
Contributor Author

srittau commented Apr 15, 2018

I managed to produce a minimal test case:

srittau@moby:~$ mkdir mypy-bug && cd mypy-bug
srittau@moby:~/mypy-bug$ mkdir -p pylibs/mypkg
srittau@moby:~/mypy-bug$ cat > pylibs/mypkg/__init__.py
def func(foo) -> bool:
    return False
srittau@moby:~/mypy-bug$ mypy --disallow-incomplete-defs pylibs
pylibs/mypkg/__init__.py:1: error: Function is missing a type annotation for one or more arguments
srittau@moby:~/mypy-bug$ mypy pylibs
srittau@moby:~/mypy-bug$ mypy --disallow-incomplete-defs pylibs
srittau@moby:~/mypy-bug$ 

@gvanrossum
Copy link
Member

I'm guessing that disallow_incomplete_defs should be included in the set PER_MODULE_OPTIONS in mypy/options.py.

@srittau srittau mentioned this issue Aug 29, 2018
12 tasks
@gvanrossum
Copy link
Member

Maybe this was fixed by #5414? My suggestion was implemented there.

@srittau
Copy link
Contributor Author

srittau commented Aug 29, 2018

I'll check when I get home.

@srittau
Copy link
Contributor Author

srittau commented Aug 29, 2018

This bug is reproducible with mypy 0.620, but not with mypy HEAD. Closing.

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

No branches or pull requests

3 participants