local / in-folder setup.cfg without mypy section shadows any additional user config files
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
As the config file read order defined by the order of the lists at https://github.com/python/mypy/blob/master/mypy/defaults.py#L15
is
CONFIG_FILES = CONFIG_FILE + SHARED_CONFIG_FILES + USER_CONFIG_FILES # type: Final
a shared config file (which may exist for several other purposes) shadows any user config files even in the case when
the shared config file contains no mypy section.
Steps to reproduce:
- Create an empty
setup.cfgin the current directory, and also have one of theUSER_CONFIG_FILEversions of a mypy config file. - Run mypy
- Notice that only the
setup.cfgfile was read, even though it had nomypysection.
`
Proposal
The logic which checks for a mypy section in the parser object (https://github.com/python/mypy/blob/master/mypy/config_parser.py#L127) should be used to check whether the parser.read call actually loaded anything meaningful from the config file. If no mypy section was loaded, then the loop over the config_files should continue instead of breaking.
This should at least be the case for any shared config files which may exist for entirely other reasons.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit der Reihenfolge von CONFIG_FILES in mypy/defaults.py und der Prüfung des parser-Abschnitts in mypy/config_parser.py. Reproduzieren Sie das Problem mit einer leeren setup.cfg und einer Benutzerkonfigurationsdatei. Überprüfen Sie anschließend, dass das Laden der Konfiguration fortgesetzt wird, wenn die gemeinsame Datei keinen mypy-Abschnitt enthält, und dass die Benutzereinstellungen wirksam werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- developer-experience, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 55/100