GDQuest / GDQuest/GDScript-formatter

Linter: doesn't respect indent size

オープン 初心者向け
#327 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
455
フォーク
39
平均マージ
1日 15時間
マージ済み PR(30日)
4

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

src/linter/rules/max_line_length.rs:24 から始めて、formatter が indent_size をどのように読み取るかを追跡します。indent_size 2 を使用する、提供された GDScript の例と linter のインデント計算を比較します。linter がその行を報告しなくなり、他のインデント設定に対する max-line-length の動作が維持されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
tooling
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
78/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。