local / in-folder setup.cfg without mypy section shadows any additional user config files
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 20.6k
- Fork
- 3.3k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dall'ordinamento di CONFIG_FILES in mypy/defaults.py e dal controllo della sezione del parser in mypy/config_parser.py. Riproduci il problema usando un setup.cfg vuoto e un file di configurazione dell'utente, quindi verifica che il caricamento della configurazione continui quando il file condiviso non contiene una sezione mypy e che le impostazioni dell'utente abbiano effetto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- developer-experience, tooling
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 55/100