10000 Only honor --warn-unused-configs in non-incremental mode (#6829) · PattenR/mypy@ad4ed84 · GitHub
[go: up one dir, main page]

Skip to content

Commit ad4ed84

Browse files
Guido van RossumPattenR
authored andcommitted
Only honor --warn-unused-configs in non-incremental mode (python#6829)
(In incremental mode it doesn't work right, and it isn't worth fixing.) Fixes python#5957
1 parent 86c42de commit ad4ed84

File tree

4 files changed

+4
-1
lines changed

4 files changed

+4
-1
lines changed

docs/source/command_line.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Config file
6565
``--warn-unused-configs``
6666
This flag makes mypy warn about unused ``[mypy-<pattern>]`` config
6767
file sections.
68+
(This requires turning off incremental mode using ``--no-incremental``.)
6869

6970

7071
.. _import-discovery:

docs/source/config_file.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ Miscellaneous
439439
``warn_unused_configs`` (bool, default False)
440440
Warns about per-module sections in the config file that do not
441441
match any files processed when invoking mypy.
442+
(This requires turning off incremental mode using ``incremental = False``.)
442443

443444
``verbosity`` (integer, default 0)
444445
Controls how much debug output will be generated. Higher numbers are more verbose.

mypy/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def flush_errors(new_messages: List[str], serious: bool) -> None:
8787
blockers = True
8888
if not e.use_stdout:
8989
serious = True
90-
if options.warn_unused_configs and options.unused_configs:
90+
if options.warn_unused_configs and options.unused_configs and not options.incremental:
9191
print("Warning: unused section(s) in %s: %s" %
9292
(options.config_file,
9393
", ".join("[mypy-%s]" % glob for glob in options.per_module_options.keys()

test-data/unit/cmdline.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,7 @@ s1.py:2: error: Incompatible return value type (got "int", expected "str")
11931193
[file mypy.ini]
11941194
[[mypy]
11951195
warn_unused_configs = True
1196+
incremental = False
11961197
[[mypy-bar]
11971198
[[mypy-foo]
11981199
[[mypy-baz.*]

0 commit comments

Comments
 (0)
0