GDQuest / GDQuest/GDScript-formatter
Linter: doesn't respect indent size
- Ngôn ngữ chính
- Rust
- Star
- 455
- Fork
- 39
- Merge trung bình
- 1 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 4
Mô tả
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.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu tại src/linter/rules/max_line_length.rs:24 và theo dõi cách formatter đọc indent_size. So sánh phép tính thụt lề của linter với ví dụ GDScript được cung cấp sử dụng indent_size 2. Hoàn tất khi linter không còn báo lỗi dòng đó, đồng thời vẫn giữ nguyên hành vi của max-line-length đối với các thiết lập thụt lề khác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- rust
- Lĩnh vực
- tooling
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 78/100