From d2c04190b8d407476c535f30d07a9f6712e7b12a Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 30 Jan 2018 07:43:17 -0800 Subject: [PATCH] Don't warn about unrecognized options starting with 'x_' (#4522) Fixes #4521 --- mypy/main.py | 2 ++ test-data/unit/cmdline.test | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/mypy/main.py b/mypy/main.py index a418dfa6cf8d..90b1285abc51 100644 --- a/mypy/main.py +++ b/mypy/main.py @@ -755,6 +755,8 @@ def parse_section(prefix: str, template: Options, print("%s: Unrecognized report type: %s" % (prefix, orig_key), file=sys.stderr) continue + if key.startswith('x_'): + continue # Don't complain about `x_blah` flags print("%s: Unrecognized option: %s = %s" % (prefix, key, section[orig_key]), file=sys.stderr) continue diff --git a/test-data/unit/cmdline.test b/test-data/unit/cmdline.test index 83e2b68be17b..86aae2d344f4 100644 --- a/test-data/unit/cmdline.test +++ b/test-data/unit/cmdline.test @@ -441,6 +441,14 @@ ignore_missing_imports = True [out] main.py:2: error: Revealed type is 'Any' +[case testConfigNoErrorForUnknownXFlagInSubsection] +# cmd: mypy -c pass +[file mypy.ini] +[[mypy] +[[mypy-foo] +x_bad = 0 +[out] + [case testDotInFilenameOKScript] # cmd: mypy a.b.py c.d.pyi [file a.b.py]