Skip to content

Unused section warning with warn_unused_configs and cache #5957

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

Closed
The-Compiler opened this issue Nov 27, 2018 · 6 comments · Fixed by #6829
Closed

Unused section warning with warn_unused_configs and cache #5957

The-Compiler opened this issue Nov 27, 2018 · 6 comments · Fixed by #6829
Assignees
Labels

Comments

@The-Compiler
Copy link
Contributor

With mypy 0.641 or the latest git master, and a config file like:

[mypy]
warn_unused_configs = True
[mypy-bdb]
ignore_missing_imports = True

checking a file like

import bdb

suppresses the error: No library stub file for standard library module 'bdb' error as expected.

However, when running mypy a second time, I assume results are retrieved from its cache, and it shows:

Warning: unused section(s) in mypy.ini: [mypy-bdb]

which means I can only use --warn-unused-configs selectively (like after editing the config), as otherwise, I'd get a lot of bogus warnings in day-to-day usage.

This is probably somewhat similar to #2960, which is the same kind of issue for --warn-unused-ignores.

@msullivan msullivan added the bug mypy got something wrong label Dec 1, 2018
@petergaultney
Copy link

I see this on 0.700 as well. passing --no-warn-unused-configs does silence the error, but it seems strange, since my

[mypy-boto3]
ignore_missing_imports = True

is definitely doing something.

@jtherrmann
Copy link

I'm getting the same problem with 0.701 with these lines in mypy.ini:

[mypy-tests.*]
disallow_untyped_defs = False

They're definitely working, but I still get the Warning: unused section(s) in mypy.ini: [mypy-tests.*] error. This happens regardless of whether .mypy_cache is present.

Though, oddly enough, I'm doing this in two different projects but only getting this problem in one of them. I haven't had time to do further debugging.

@JukkaL
Copy link
Collaborator

JukkaL commented May 13, 2019

Increasing priority since this seems to affect quite a few people. I think that I've seen this myself as well.

@gvanrossum
Copy link
Member

I can do this. Or we can mark it "easy first issue"?

@JukkaL
Copy link
Collaborator

JukkaL commented May 13, 2019

I suspect that this might be a bit difficult for a first issue, at least without a few hints.

@gvanrossum gvanrossum self-assigned this May 13, 2019
@gvanrossum
Copy link
Member

gvanrossum commented May 14, 2019

I can do a simple version of this: ignore the flag when in incremental mode (which is the default). I'm not sure I'm up to fixing it the way we fixed warn_redundant_casts / warn_unused_ignores.

gvanrossum pushed a commit that referenced this issue May 15, 2019
(In incremental mode it doesn't work right, and it isn't worth fixing.)

Fixes #5957
PattenR pushed a commit to PattenR/mypy that referenced this issue Jun 23, 2019
(In incremental mode it doesn't work right, and it isn't worth fixing.)

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

Successfully merging a pull request may close this issue.

7 participants