Parsing gives incorrect/unexpected/inconsistent error results
まだ誰も着手していません。
評価
調査の方向性
issue に示されているコマンドと引数を使用して、RawApi_Version_Error_tests と RawApi_Help_Error_tests の動作を再現します。報告されたエラー数とメッセージを、想定されるパースおよびバリデーションの動作と比較します。完了時には、--help と --version の処理を含め、パースエラーとアプリケーション依存のバリデーションを明確かつ制御可能に分離できている状態にします。
索引モデルが issue の本文から書いたものです。
説明
Version: 2.0.0-beta7.25380.108 (Latest NuGet as of this writing)
[TestMethod]
public void RawApi_Version_Error_tests( )
{
var rootCommand = new RootCommand("Test Root")
{
new Option<string>("--option1")
{
Description = "Test option `",
Required = true,
},
};
var result = rootCommand.Parse(["--FooBar", "--version"]);
Assert.HasCount( 3, result.Errors, "Errors should account for, bogus arg (`--FooBar`), missing required arg (`--option1`), AND that `--version` should be solo" );
}
This test won't pass, the error count is only 2, the error regarding the --version is completely missing.
Errors are:
[0] = "Unrecognized command or argument '--FooBar'."
[1] = "Option '--option1' is required."
For help it's even worse...
[TestMethod]
public void RawApi_Help_Error_tests( )
{
var rootCommand = new RootCommand("Test Root")
{
new Option<string>("--option1")
{
Description = "Test option `",
Required = true,
},
};
var result = rootCommand.Parse(["--FooBar", "--help"]);
Assert.HasCount( 3, result.Errors, "Errors should account for, bogus arg (`--FooBar`), missing required arg (`--option1`), AND that `--version` should be solo" );
}
This results in NO errors. But the expectation is that an error for the bogus param AND the missing required argument is present. Basically, the problem is one of co-mingling parsing (which is really lex+parse) with validation which is semantic analysis and is VERY application dependent. Ideally, there is a way to disable all validations and move that to a distinct operation the application is in control of.
- 主要言語
- C#
- スター
- 3.7k
- フォーク
- 434
- 平均マージ
- 4時間 46分
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dotnet/command-line-api のほかの issue
-
German localization is incomplete対応中かも @b-v-d-e-v が 8 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
dotnet/command-line-api#2852 ·
-
Incomplete French (fr) translation: RequiredOptionWasNotProvided not translated対応中かも @JPBlanc が 105 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
dotnet/command-line-api#2822 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
dotnet/command-line-api#2792 · コメント 2 件 · リアクション 16 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
dotnet/command-line-api#2704 ·
-
GetCompletions should check exit code of invoked application対応中かも @baradgur が 1277 日前に担当しました。 オープンArea-Completions bug help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
dotnet/command-line-api#2137 · コメント 1 件 · リアクション 3 件 ·
dotnet/command-line-api の issue をすべて見る
似ている issue
-
[Tool] DirectBenchオープンhas-image has-readme needs-attention new-tool repo-verified
難易度 1/5 1〜3時間 初心者へのやさしさ 62/100
shanselman/TinyToolTown#844 · コメント 2 件 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
PCL-Community/PCL-CE#3658 ·
メンテナーはふだん 1 日以内に返信
-
Deploy & Patch-issues opprettes ikke: create-pnd-issues.yml har feilet hver uke siden 2025-09-08オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Altinn/altinn-auth#4359 ·
メンテナーはふだん 1 日以内に返信
-
アプリ: チャット 優先: 中 提案
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
yksr-melt/Meltype#243 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug core
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信