Skip to content

Commit a6e5963

Browse files
gclinchgvanrossum
authored andcommitted
Helpful error message when 'strict' is found in configuration file, which is unsupported (#4706)
Fixes #3858
1 parent da71cde commit a6e5963

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

mypy/main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,8 +766,13 @@ def parse_section(prefix: str, template: Options,
766766
continue
767767
if key.startswith('x_'):
768768
continue # Don't complain about `x_blah` flags
769-
print("%s: Unrecognized option: %s = %s" % (prefix, key, section[orig_key]),
770-
file=sys.stderr)
769+
elif key == 'strict':
770+
print("%s: Strict mode is not supported in configuration files: specify "
771+
"individual flags instead (see 'mypy -h' for the list of flags enabled "
772+
"in strict mode)" % prefix, file=sys.stderr)
773+
else:
774+
print("%s: Unrecognized option: %s = %s" % (prefix, key, section[orig_key]),
775+
file=sys.stderr)
771776
continue
772777
ct = type(dv)
773778
v = None # type: Any

0 commit comments

Comments
 (0)