--baseline with --files/--changed-since reports unlinted entries as stale

Đang mở Phù hợp với người mới
#106 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 2 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
85/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ệ
node.js, typescript
Lĩnh vực
cli, testing

Hướng nghiên cứu

Đọc src/baseline.ts quanh applyBaseline và src/cli.ts quanh các dòng 364–380 để theo dõi cách các tệp được thu hẹp phạm vi đi vào quá trình tính baseline. Sau đó xem lại test/cli.test.ts và chạy trường hợp tái hiện được báo cáo với --files; hoàn tất khi các tệp chưa được lint bị loại khỏi số lượng mục lỗi thời và bài kiểm thử xác nhận không có mục lỗi thời nào.

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

Mô tả

bug good first issue severity: low

Summary

gdcorrect lint --baseline b.json --files ... (or --changed-since) counts every baseline entry for files that were not linted as "stale (fixed)", and tells the user they can be removed by rewriting the baseline.

Where

  • src/cli.ts:364-380
  • src/baseline.ts:101 (stale = every entry no finding consumed)

Details

applyBaseline has no idea the run was narrowed, so entries for unlinted files are never consumed. The stderr message then says "N baseline entries are stale (fixed) and can be removed by rewriting it", and staleBaselineEntries in the JSON is inflated by the same amount. --write-baseline with narrowing is (correctly) refused, so the message pushes users toward a full rewrite they do not need.

Impact

On pre-commit and PR runs, the main use of --changed-since, the stale count is misleading and grows with the size of the baseline.

Steps to reproduce

  1. Create a 3-file project with one finding per file and run gdcorrect lint p --write-baseline b.json.
  2. Run gdcorrect lint p --files p/a.gd --baseline b.json.
  3. stderr says "1 finding(s) matched the baseline; 2 baseline entries are stale (fixed)...".

Suggested fix

Pass the narrowed file set into applyBaseline, and count only stale entries whose file is in it.

Acceptance criteria

  • The repro reports 0 stale entries.
  • A test covers --baseline combined with --files.

Getting started

  • Relevant files: src/baseline.ts, src/cli.ts, test/cli.test.ts
  • How to run tests: npm run build && npm test

Filed by repo-audit/full-audit at e836036. Severity: low. Effort: S. audit-key: bug|src/cli.ts|baseline+narrowed

Ngôn ngữ chính
TypeScript
Star
0
Fork
6
Merge trung bình
1 ngày 21 giờ
Pull request đã merge (30 ngày)
8

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 TMHSDigital/godot-correctness-mcp

Tất cả issue của TMHSDigital/godot-correctness-mcp

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.