Validate command input and handle bad values cleanly

Abierto
#73 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
50/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
java
Área
backend, testing

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
Java
Estrellas
1
Forks
0
Merge medio
2 h 35 min
PR fusionados (30 d)
14

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de BrendonButler/Shops

Todos los issues de BrendonButler/Shops

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.