Validation cleanups: library re-checks Options.Validate ranges; TUI labels drift
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Đọc Config.options trong pkg/subenum/subenum.go cùng với Options.Validate trong internal/scan/options.go, sau đó kiểm tra việc phân tích số trong internal/tui/form.go. Thêm các kiểm thử dạng bảng được đề xuất và xóa các kiểm tra thư viện bị trùng lặp; cập nhật nhãn phân tích của TUI để dùng formFields. Chạy go test ./pkg/subenum/ ./internal/tui/ và xác nhận các lỗi nêu tên các trường Config và nhãn hiển thị trên màn hình.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Two small validation cleanups:
- The library's
Config.optionsre-checks ranges thatscan.Options.Validatealready checks, and its wording has drifted. - The TUI's 154-line
form.validatemixes hard-coded field labels withformFieldsnames.
Where
pkg/subenum/subenum.go:619-641,724-726;internal/scan/options.go:69-95internal/tui/form.go:505-659(in particular569-584)
Details
- Library.
options()rejectsRate < 0,MaxQueries < 0,HitRateoutside 1-100 and a bad resolver, then callsopts.Validate(), which checks the same four things with different text. Only the negative checks for Concurrency, Timeout, Attempts and Depth belong to the library, because 0 means "use the default" there.options.go:21-25says the shared validator exists so that front ends "cannot drift apart in what they accept". - TUI.
num(fieldConcurrency, "Concurrency"),"Timeout","Attempts","Hit rate","Depth","Rate"and"Max queries"are string literals, while the next line usesformFields[fieldRatePerResolver].name(). Renaming a form label leaves parse errors that name the old label.
Suggested fix
Each step is safe on its own:
-
Library:
- Table tests on
Config.ValidateforRate=-1,MaxQueries=-1,HitRate=101withSimulate, and a badResolver, asserting that the error names the Config field. - Delete the four duplicated checks from
options().fieldNamesalready renders tokens as Config field names.
- Table tests on
-
TUI:
- Make
num(f)take its label fromformFields[f].name(). - Optionally extract
parseNumbersandparseListshelpers.
Test first: a table test with one invalid value per numeric field, asserting the error names the field's on-screen label.
- Make
Acceptance criteria
- One source of truth for the library's range checks
- TUI parse errors use the on-screen field labels
Getting started
- Relevant files:
pkg/subenum/subenum.go,internal/scan/options.go,internal/tui/form.go - How to run tests:
go test ./pkg/subenum/ ./internal/tui/ - Related: #262, #331
Filed by repo-audit/full-audit at dd5b156. Severity: low. Effort: S. audit-key: tech-debt|pkg/subenum/subenum.go|Config.options
- Ngôn ngữ chính
- Go
- Star
- 1
- Fork
- 1
- Merge trung bình
- 7 giờ 18 phút
- Pull request đã merge (30 ngày)
- 23
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- 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 TMHSDigital/subenum
-
area: tui good first issue severity: low testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
TMHSDigital/subenum#413 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue severity: low testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
TMHSDigital/subenum#412 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue performance severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
TMHSDigital/subenum#411 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug github-actions good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
TMHSDigital/subenum#407 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: cli severity: medium tech-debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
TMHSDigital/subenum#402 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của TMHSDigital/subenum
Issue tương tự
-
Client execution contract accepts a grant the code never takesCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởarea: client enhancement priority: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
opensro-dev/opensro#3808 ·
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 70/100
Maintainer thường phản hồi trong vòng 2 ngày
-
hive size:simple
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
CI should run metbench validateĐang mởgood first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Edwin-metcalf/MetCode#54 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
gen ctrl: appends duplicate parameterless NewV1()/ControllerV1 when the existing NewV1 takes parametersCó thể đã có người làm @Lizjunn đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày