diffx.Stat skips changed lines whose text starts with "++" or "--"
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 87/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- go
- Lĩnh vực
- backend, testing-qa
Hướng nghiên cứu
Đọc internal/diffx/diffx.go quanh Stat và hành vi tạo diff được mô tả trong issue; sau đó chạy các bài kiểm thử diffx và bổ sung các trường hợp cho dòng -- bị xóa, dòng ++ được thêm và tiêu đề tệp. Cập nhật Stat để đếm các dòng đã thay đổi bên trong hunk, đồng thời bỏ qua tiêu đề tệp. Công việc hoàn tất khi các tiêu chí chấp nhận được đáp ứng và make test-short chạy thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Stat treats every line starting with +++ or --- as a file header, so an added line whose text starts with ++ and a removed line whose text starts with -- are not counted. The 400-line limit on a model-written patch is computed from this count.
Where
internal/diffx/diffx.go:103-110(Stat)internal/agent/fixcheck.go:44,:194(added + removedagainstmaxPatchLines = 400)
Details
unified writes an added line as "+" + text and a removed one as "-" + text. An added ++i; becomes +++i;; a removed SQL, Lua or Haskell comment -- note, a YAML --- separator or a --flag \ continuation line becomes --- note. Both match the header case and are skipped.
Impact
The size of a fix is undercounted, so the patch size limit does not hold for such lines; a patch that removes or adds many of them can be far over the limit and still be accepted.
Steps to reproduce
- Call
diffx.Stat(diffx.Unified("a.sql", "-- one\n-- two\nSELECT 1;\n", "SELECT 1;\n")). - It returns
(0, 0); the diff removes two lines.
Suggested fix
Count by position, not by prefix alone: skip --- / +++ only for the two lines that follow a diff --git line (or its mode line) and precede the first @@; inside a hunk count every + and - line.
Acceptance criteria
-
Stat(Unified("a.sql", "-- one\n-- two\nSELECT 1;\n", "SELECT 1;\n"))returns 0 added, 2 removed - An added
++i;line counts as 1 added - File headers are still not counted
Getting started
- Relevant files: internal/agent/fixcheck.go, internal/diffx/diffx.go
- How to run tests:
make test-short(Unix) or.\make.ps1 test-short(Windows PowerShell);make lintbefore you call it done - Related docs: CONTRIBUTING.md, docs/ARCHITECTURE.md
Filed by repo-audit/full-audit at 50e92ec. Severity: low. Effort: S. audit-key: bug|internal/diffx/diffx.go|Stat
- Ngôn ngữ chính
- Go
- Star
- 0
- Fork
- 1
- Merge trung bình
- 8 giờ 14 phút
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TMHSDigital/Spackle
-
ci good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
TMHSDigital/Spackle#206 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ci severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
TMHSDigital/Spackle#205 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
TMHSDigital/Spackle#199 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue severity: medium
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
TMHSDigital/Spackle#188 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue severity: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
TMHSDigital/Spackle#187 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của TMHSDigital/Spackle
Issue tương tự
-
deskclose human-decided leaves the legacy decision-needed label and applies no human-decidedĐang mởbug effort:s impact:med raised-by:worker risk:low to:worker
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
medici-finance/assay#8120 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
factory:subtask
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
agent-substrate/substrate#4308 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
celestiaorg/celestia-app#8877 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
sweep
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
bketelsen/truenas-mcp#112 ·
Maintainer thường phản hồi trong vòng 1 ngày