Click 8.5.0: omitted boolean flags incorrectly trigger conflicting_options validation
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 66/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 4
- Forks
- 25
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de aboutcode-org/commoncode
-
Consider that Resource.parent can be None when removing resources from the codebaseTalvez já em andamento @Mirochill assumiu há 177 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
aboutcode-org/commoncode#84 ·
-
Revisit cliutils.pyAberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
aboutcode-org/commoncode#102 · 1 comentário ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 45/100
aboutcode-org/commoncode#101 · 1 comentário ·
-
mass-scan: Create library to collect a whole project version from Software HeritageTalvez livre de novo @chinyeungli assumiu há 264 dias e não há nenhum pull request aberto. Aberta
aboutcode-org/commoncode#77 · 7 comentários · 1 responsável ·
-
Fix DeprecationWarning in timeutils.py and archive.pyTalvez já em andamento @shashank-tomar0 assumiu há 10 dias. Abertagood first issue
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 42/100
aboutcode-org/commoncode#75 · 1 comentário ·
Todas as issues de aboutcode-org/commoncode
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
mohanraj00/entelos#200 ·
Mantenedores costumam responder em até 1 dia
-
Dead url in mise.tomlAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 68/100
-
sweep
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
bketelsen/truenas-mcp#77 ·
Mantenedores costumam responder em até 1 dia
-
Console writes URL credentials to the local log, though AGENTS.md says secrets never reach diskAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 86/100
sandbox-quantum/switch#2163 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
openedx/xblock-lti-consumer#765 ·
Mantenedores costumam responder em até 1 dia