Click 8.5.0: omitted boolean flags incorrectly trigger conflicting_options validation
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 66/100
Línea de trabajo
The bug is in validate_option_dependencies() and PluggableCommandLineOption in the commoncode cliutils module, which decide whether an option counts as used. Run the reproduction script from the issue with click 8.5.0 and again with 8.4.2 to compare. Find how the check tells a supplied flag from a default, since click 8.5.0 seems to report omitted flags differently. Done when the script prints OK on click 8.5.0 and a regression test covers omitted boolean flags.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
With commoncode 33.0.0 and click 8.5.0, validate_option_dependencies() incorrectly reports a conflict between mutually exclusive boolean flags when neither flag is supplied:
Error: The option --strip-root cannot be used together with the --full-root option(s) and --full-root is used. You can set only one of these options at a time.
This breaks scancode 32.4.1 with conflict between --strip-root and --full-root. The problem reproduces using commoncode alone as well.
Tested with Python 3.12. CommonCode 32.4.2 is also affected. The same checks pass with Click 8.4.2.
How to standalone reproduce the error:
- Create
test.py:
import click
from commoncode import cliutils
@click.command()
@click.option(
"--strip-root", is_flag=True,
cls=cliutils.PluggableCommandLineOption,
conflicting_options=["full_root"],
)
@click.option(
"--full-root", is_flag=True,
cls=cliutils.PluggableCommandLineOption,
conflicting_options=["strip_root"],
)
@click.pass_context
def cli(ctx, strip_root, full_root):
cliutils.validate_option_dependencies(ctx)
click.echo("OK")
if __name__ == "__main__":
cli()
- Use packages:
python -m pip install commoncode==33.0.0 click==8.5.0 - Run:
python test.py-> expected output: OK, actual:Error: The option --strip-root cannot be used together with the --full-root option(s) and --full-root is used. You can set only one of these options at a time.
With click 8.4.2 the out put is OK.
- Lenguaje dominante
- Python
- Estrellas
- 4
- Forks
- 25
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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.
Más de aboutcode-org/commoncode
-
Consider that Resource.parent can be None when removing resources from the codebasePosiblemente ocupada @Mirochill la tomó hace 177 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
aboutcode-org/commoncode#84 ·
-
Revisit cliutils.pyAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
aboutcode-org/commoncode#102 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
aboutcode-org/commoncode#101 · 1 comentario ·
-
mass-scan: Create library to collect a whole project version from Software HeritageQuizá libre de nuevo @chinyeungli la tomó hace 264 días y no hay ningún pull request abierto. Abierto
aboutcode-org/commoncode#77 · 7 comentarios · 1 asignado ·
-
Fix DeprecationWarning in timeutils.py and archive.pyPosiblemente ocupada @shashank-tomar0 la tomó hace 10 días. Abiertogood first issue
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
aboutcode-org/commoncode#75 · 1 comentario ·
Todos los issues de aboutcode-org/commoncode
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
GoogleCloudPlatform/professional-services-data-validator#1899 ·
Los mantenedores suelen responder en 4 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
mohanraj00/entelos#200 ·
Los mantenedores suelen responder en 1 día
-
Dead url in mise.tomlAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
-
sweep
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
bketelsen/truenas-mcp#77 ·
Los mantenedores suelen responder en 1 día
-
Console writes URL credentials to the local log, though AGENTS.md says secrets never reach diskAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
sandbox-quantum/switch#2163 ·
Los mantenedores suelen responder en 1 día