Skip to content

Commit d2c0419

Browse files
gvanrossumilevkivskyi
authored andcommitted
Don't warn about unrecognized options starting with 'x_' (#4522)
Fixes #4521
1 parent 73e58da commit d2c0419

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

mypy/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ def parse_section(prefix: str, template: Options,
755755
print("%s: Unrecognized report type: %s" % (prefix, orig_key),
756756
file=sys.stderr)
757757
continue
758+
if key.startswith('x_'):
759+
continue # Don't complain about `x_blah` flags
758760
print("%s: Unrecognized option: %s = %s" % (prefix, key, section[orig_key]),
759761
file=sys.stderr)
760762
continue

test-data/unit/cmdline.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,14 @@ ignore_missing_imports = True
441441
[out]
442442
main.py:2: error: Revealed type is 'Any'
443443

444+
[case testConfigNoErrorForUnknownXFlagInSubsection]
445+
# cmd: mypy -c pass
446+
[file mypy.ini]
447+
[[mypy]
448+
[[mypy-foo]
449+
x_bad = 0
450+
[out]
451+
444452
[case testDotInFilenameOKScript]
445453
# cmd: mypy a.b.py c.d.pyi
446454
[file a.b.py]

0 commit comments

Comments
 (0)