local / in-folder setup.cfg without mypy section shadows any additional user config files
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 20.6k
- Forks
- 3.3k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el orden de CONFIG_FILES en mypy/defaults.py y la comprobación de la sección del parser en mypy/config_parser.py. Reproduce el problema usando un setup.cfg vacío y un archivo de configuración del usuario; después, verifica que la carga de la configuración continúa cuando el archivo compartido no tiene una sección mypy y que la configuración del usuario se aplica.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- developer-experience, tooling
- Tipo de issue
- Error
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 55/100