GDQuest / GDQuest/GDScript-formatter
Linter: no-else-return failing to detect return in this case
- Lenguaje dominante
- Rust
- Estrellas
- 455
- Forks
- 39
- Merge medio
- 1 d 15 h
- PR fusionados (30 d)
- 4
Descripción
There is a bug in your linter that causes it to not recognize that the designated block can fail the if statement and skip the return statement:
1) The incorrect warning is:
“WARNING on line 75 (no-else-return)
Unnecessary 'else' after 'if'/'elif' blocks that end with 'return'”
2) The code that triggered this error is:
...
#Return false if vector_angle falls between start_arc and end_arc.
#This will ensure that weapons can only fire within their designated arcs.
if end_arc > start_arc:
if vector_angle > end_arc or vector_angle < start_arc:
return false
else:
if vector_angle > end_arc and vector_angle < start_arc:
return false
#Ensure target is within range
if vector_to_target.length() > ability_range:
return false
else:
return true
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Comienza por la implementación del linter para la regla no-else-return y reproduce la advertencia con el fragmento anidado de if/else proporcionado. La tarea estará terminada cuando la regla ya no informe de que el else final es innecesario cuando la rama anterior puede continuar, con cobertura de regresión para este caso.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- godot, rust
- Área
- tooling
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Activo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 68/100