Click 8.5.0: omitted boolean flags incorrectly trigger conflicting_options validation
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 66/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Python
- Sterne
- 4
- Forks
- 25
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus aboutcode-org/commoncode
-
Consider that Resource.parent can be None when removing resources from the codebaseEvtl. vergeben @Mirochill hat das vor 177 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
aboutcode-org/commoncode#84 ·
-
Revisit cliutils.pyOffen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
aboutcode-org/commoncode#102 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
aboutcode-org/commoncode#101 · 1 Kommentar ·
-
mass-scan: Create library to collect a whole project version from Software HeritageEvtl. wieder frei @chinyeungli hat das vor 264 Tagen übernommen, und es ist kein Pull Request offen. Offen
aboutcode-org/commoncode#77 · 7 Kommentare · 1 zugewiesene Person ·
-
Fix DeprecationWarning in timeutils.py and archive.pyEvtl. vergeben @shashank-tomar0 hat das vor 10 Tagen übernommen. Offengood first issue
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 42/100
aboutcode-org/commoncode#75 · 1 Kommentar ·
Alle Issues in aboutcode-org/commoncode
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
mohanraj00/entelos#200 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Dead url in mise.tomlOffen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 68/100
-
sweep
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
bketelsen/truenas-mcp#77 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Console writes URL credentials to the local log, though AGENTS.md says secrets never reach diskOffen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 86/100
sandbox-quantum/switch#2163 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
openedx/xblock-lti-consumer#765 ·
Maintainer antworten meist innerhalb von 1 Tag