code-duplication: a "block" is the tail after the last arrow line, and message tables normalise to the same text

Đang mở
#432 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
46/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
tooling

Hướng nghiên cứu

Start with code-duplication-control.ts around lines 95, 153–157, and 194, then read the law’s satisfiedBy description and its tests to understand the intended definition of duplication. Compare the current findings with the self-audit counts in the issue, including the copied helpers that should remain flagged. Done means one-line idioms, type members, and message tables with different text stop being reported while genuine copied function bodies are still detected.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Found in the 8.0.0 self-audit triage: RoC 7.29.1 (npm, 5fc54afe) on a clean clone of develop at 2d2fa9a, with typescript resolvable (verdict compliance, 0 failed / 46 warnings). The bucket method and per-law tables are kept by QA; counts are from that run.

What happens

Code Duplication Control (37 findings) extracts "blocks" by restarting at every line containing => or function (code-duplication-control.ts:153-157) and replaces every string literal with STR (:194), with a 50-character minimum (:95). Result: one-line idioms, call-site fragments, type members (checker: (c) => boolean) and message tables with different text are "duplicates" (16 ii-a + 2 from the detector's own example tables). 12 findings are real copied helpers (several safeReadFile/escapeRe/stripComments/mergeResults copies) and should stay.

Suggested direction

Compare real function/method bodies from the TypeScript AST with a token/line floor (the law's own satisfiedBy talks about identical function bodies), or consume jscpd output — the repository already has jscpd as a devDependency.

Ngôn ngữ chính
TypeScript
Star
0
Fork
0
Merge trung bình
38 phút
Pull request đã merge (30 ngày)
96

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Rule-Of-Code/RoC

Tất cả issue của Rule-Of-Code/RoC

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.