Click 8.5.0: omitted boolean flags incorrectly trigger conflicting_options validation
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 4
- フォーク
- 25
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
aboutcode-org/commoncode のほかの issue
-
Consider that Resource.parent can be None when removing resources from the codebase対応中かも @Mirochill が 177 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
aboutcode-org/commoncode#84 ·
-
Revisit cliutils.pyオープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
aboutcode-org/commoncode#102 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
aboutcode-org/commoncode#101 · コメント 1 件 ·
-
mass-scan: Create library to collect a whole project version from Software Heritage再び着手できるかも @chinyeungli が 264 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
aboutcode-org/commoncode#77 · コメント 7 件 · 担当者 1 名 ·
-
Fix DeprecationWarning in timeutils.py and archive.py対応中かも @shashank-tomar0 が 10 日前に担当しました。 オープンgood first issue
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
aboutcode-org/commoncode#75 · コメント 1 件 ·
aboutcode-org/commoncode の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
GoogleCloudPlatform/professional-services-data-validator#1899 ·
メンテナーはふだん 4 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
mohanraj00/entelos#200 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
-
sweep
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
bketelsen/truenas-mcp#77 ·
メンテナーはふだん 1 日以内に返信
-
Console writes URL credentials to the local log, though AGENTS.md says secrets never reach diskオープン
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
sandbox-quantum/switch#2163 ·
メンテナーはふだん 1 日以内に返信