GDQuest / GDQuest/GDScript-formatter

Linter: doesn't respect indent size

Abierto Apto para principiantes
#327 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Rust
Estrellas
455
Forks
39
Merge medio
1 d 15 h
PR fusionados (30 d)
4

Descripción

After changing `indent_size` to 2 in my `.editorconfig`, I noticed that the formatter wouldn't format certain lines that the linter would flag. It looks like the max line length calculation of the linter assumes the indent size is 4 rather than using the same indent size config that the formatter uses.

Here's a basic GDScript example that the linter flags as too long even though it should be within the max line length limit. This is supported by the fact that the formatter does not format the line since it respects the `indent_size`.

```gdscript
func test() -> Array[String]:
# This line is incorrectly flagged by the linter when indent_size is 2.
return ["echo", "echo", "echo", "echo", "echo", "echo", "echo", "echo", "echo", "echo", "echooo"]
```

The offending line looks to be https://github.com/GDQuest/GDScript-formatter/blob/29e2dc993b2ed746f50dae594357e020f7ccc3b9/src/linter/rules/max_line_length.rs#L24

The indent is increments by a hard-coded 4.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start at src/linter/rules/max_line_length.rs:24 and trace how the formatter reads indent_size. Compare the linter's indentation calculation with the provided GDScript example using indent_size 2. Done when the linter no longer flags that line while preserving max-line-length behavior for other indentation settings.

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

Evaluación

Stack tecnológico
rust
Área
tooling
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Tranquilo
Claridad
Bien especificado
Aptitud para principiantes
78/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.