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.
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
|
.fold(0, |acc, ch| if ch == '\t' { acc + 4 } else { acc + 1 }); |
The indent is increments by a hard-coded 4.
After changing
indent_sizeto 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.The offending line looks to be
GDScript-formatter/src/linter/rules/max_line_length.rs
Line 24 in 29e2dc9
The indent is increments by a hard-coded 4.