GDQuest / GDQuest/GDScript-formatter

Linter: doesn't respect indent size

Open Beginner friendly
#327 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
455
Forks
39
Avg merge
1d 15h
Merged PRs (30d)
4

Description

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

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.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.