Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Closed
Description
When--mypy-config-file is passed tostubtest is usesparse_config_file function. Which does not handledisable_error_code setting correctly. Since it is done in another place (mypy/main.py):
Lines 1339 to 1353 ina0dbbd5
| # Process `--enable-error-code` and `--disable-error-code` flags | |
| disabled_codes=set(options.disable_error_code) | |
| enabled_codes=set(options.enable_error_code) | |
| valid_error_codes=set(error_codes.keys()) | |
| invalid_codes= (enabled_codes|disabled_codes)-valid_error_codes | |
| ifinvalid_codes: | |
| parser.error(f"Invalid error code(s):{', '.join(sorted(invalid_codes))}") | |
| options.disabled_error_codes|= {error_codes[code]forcodeindisabled_codes} | |
| options.enabled_error_codes|= {error_codes[code]forcodeinenabled_codes} | |
| # Enabling an error code always overrides disabling | |
| options.disabled_error_codes-=options.enabled_error_codes |
There are similar cases of options that are post-processed there, but not inparse_config_file, but let's fix them one by one to reduce potential regressions.
I propose addingprocess_error_codes method toOptions object so it can be used in bothmain.py andstubtest.py (and others likestubgen in the future).
Found while working onpython/typeshed#12463