Skip to content
Merged
Changes from 2 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
13 changes: 13 additions & 0 deletions mypy/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,19 @@ def parse_section(
options_key = key
if key in config_types:
ct = config_types[key]
elif key in ("enabled_error_codes", "disabled_error_codes"):
# These should be "enable_error_code" and "disable_error_code". But because these fields
# exist on Options, we would otherwise accept them here and crash later.
suggestion = {
"enabled_error_codes": "enable_error_code",
"disabled_error_codes": "disable_error_code",
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move the dict outside of the loop and check against e.g. key in option_replacements to avoid the repetition?

print(
f"{prefix}Unrecognized option: {key} = {section[key]}"
f" (did you mean {suggestion[key]}?)",
file=stderr,
)
continue
else:
dv = None
# We have to keep new_semantic_analyzer in Options
Expand Down