New setting "user_builtins_name": Ignore specific "name-defined" errors
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
Feature
Adding a setting "user_builtins_name", or "builtins", that is a array of strings for which the error [name-defined] is ignored.
Pitch
It is possible to extend the list of builtins function, which can be very useful in some projects as we no longer need to import this function if it's used extensively in the rest of the project.
Example:
builtins.__dict__['prints'] = prints = PrefixedPrint()
builtins.__dict__['_'] = localization.gettext
Sadly, mypy don't support such exotic things. There is two solution:
- Analyzer all the code to add dynamically the "user builtins name"
- Add a user-controlled setting to globally ignore specific "name-defined" errors
The first would be the best, but also the harder to implement. The second would be easier to implement, but some ignored 'name-defined' error could be legitimate depending on the import and call stack. But since the very exotic and niche feature, the risks are low and we can assume that the user know what he do when he use this settings.
The use of a setting name that contain the word 'builtins' allows to explicitly specify the user case of such setting (when a generic "ignore_name_defined" could be misinterpreted and so misused)
Related Issues
#7931
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 revisando el issue relacionado #7931 y el manejo de configuración existente de mypy para los diagnósticos name-defined. Rastrea dónde se producen estos errores y cómo se prueban las configuraciones; se considera terminado cuando una configuración builtins-name controlada por el usuario suprima únicamente los errores especificados y esto esté cubierto por pruebas y documentación adecuadas.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- devtools
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100