8000 Only honor --warn-unused-configs in non-incremental mode by gvanrossum · Pull Request #6829 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Only honor --warn-unused-configs in non-incremental mode #6829

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Config file
``--warn-unused-configs``
This flag makes mypy warn about unused ``[mypy-<pattern>]`` config
file sections.
(This requires turning off incremental mode using ``--no-incremental``.)


.. _import-discovery:
Expand Down
1 change: 1 addition & 0 deletions docs/source/config_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ Miscellaneous
``warn_unused_configs`` (bool, default False)
Warns about per-module sections in the config file that do not
match any files processed when invoking mypy.
(This requires turning off incremental mode using ``incremental = False``.)

``verbosity`` (integer, default 0)
Controls how much debug output will be generated. Higher numbers are more verbose.
2 changes: 1 addition & 1 deletion mypy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def flush_errors(new_messages: List[str], serious: bool) -> None:
blockers = True
if not e.use_stdout:
serious = True
if options.warn_unused_configs and options.unused_configs:
if options.warn_unused_configs and options.unused_configs and not options.incremental:
print("Warning: unused section(s) in %s: %s" %
(options.config_file,
", ".join("[mypy-%s]" % glob for glob in options.per_module_options.keys()
Expand Down
1 change: 1 addition & 0 deletions test-data/unit/cmdline.test
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,7 @@ s1.py:2: error: Incompatible return value type (got "int", expected "str")
[file mypy.ini]
[[mypy]
warn_unused_configs = True
incremental = False
[[mypy-bar]
[[mypy-foo]
[[mypy-baz.*]
Expand Down
0