Parsing gives incorrect/unexpected/inconsistent error results
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Tái hiện hành vi trong RawApi_Version_Error_tests và RawApi_Help_Error_tests bằng lệnh và các đối số được hiển thị trong issue. So sánh số lượng và thông báo lỗi được báo cáo với hành vi parsing và validation dự kiến. Việc hoàn thành cần thiết lập sự tách biệt rõ ràng, có thể kiểm soát giữa lỗi parsing và validation phụ thuộc vào ứng dụng, bao gồm cả việc xử lý --help và --version.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C#
- Star
- 3.7k
- Fork
- 434
- Merge trung bình
- 4 giờ 46 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dotnet/command-line-api
-
German localization is incompleteCó thể đã có người làm @b-v-d-e-v đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
dotnet/command-line-api#2852 ·
-
Incomplete French (fr) translation: RequiredOptionWasNotProvided not translatedCó thể đã có người làm @JPBlanc đã nhận 104 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
dotnet/command-line-api#2822 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
dotnet/command-line-api#2792 · 2 bình luận · 16 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
dotnet/command-line-api#2704 ·
-
GetCompletions should check exit code of invoked applicationCó thể đã có người làm @baradgur đã nhận 1276 ngày trước. Đang mởArea-Completions bug help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
dotnet/command-line-api#2137 · 1 bình luận · 3 reaction ·
Tất cả issue của dotnet/command-line-api
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
stryker-mutator/stryker-net#3892 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
MobiFlight/MobiFlight-Connector#3419 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`Source` with an `avares://` URI and a `#fragment` throws instead of scrolling to the anchorĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Kryptos-FR/MarkView.Avalonia#105 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[辞書]Đang mở提案 辞書
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
microsoft/fluentui-blazor#5410 ·
Maintainer thường phản hồi trong vòng 1 ngày