Validate command input and handle bad values cleanly

Đang mở
#73 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
50/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
backend, testing

Hướng nghiên cứu

Start by reading the command handlers for /shop add, update, delete, sell, and create, plus identifyStore and the tab completer; the issue does not name their files. Run the existing tests that reproduce the first three rows and the sell case, then add coverage for the remaining rows. Done means invalid input leaves state unchanged, duplicate matches use STORE_MULTI_MATCH in commands and completion, and all listed cases are covered.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Problem

Several commands accept input they can't handle, or fail with an unhelpful error.

Input Result
/shop add stone NaN NaN -1 1 (also Infinity, and the same through update) Accepted. /shop buy on that item then always fails with "Invalid numerical value"
/shop add stone -3 with shops.update.inf-stock Takes 3 from the store's stock, then reports "Invalid number of arguments"
/shop update location Dup ... when two stores are named Dup MultipleStoresMatchedException isn't caught, so "An internal error occurred". The tab completer calls identifyStore unguarded too
/shop delete abc~ when a store named abc exists split("~") leaves no second part, so input[1] throws
Store names containing ~ Created normally, but can't be found by name afterward
/shop sell notreal all Reports "Invalid quantity (0)" instead of an invalid material
/shop create <name> <player> The limit is checked against the sender's stores, not the new owner's

The first three rows and the sell row were reproduced in tests. The others come from reading the code.

Done when

  • Prices must be finite numbers, and negative values are only accepted where they have a meaning.
  • A failed command changes nothing.
  • Duplicate-name errors show STORE_MULTI_MATCH everywhere, including tab completion.
  • Store names can't contain ~, or the parser handles them.
  • Tests cover each row.
Ngôn ngữ chính
Java
Star
1
Fork
0
Merge trung bình
2 giờ 35 phút
Pull request đã merge (30 ngày)
14

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của BrendonButler/Shops

Tất cả issue của BrendonButler/Shops

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.