Skip to content

Linter doesn't respect indent size #327

Description

@nathaniellam

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions