check-links accepts --stale-days=N and then ignores it (365 is used)

Đang mở Phù hợp với người mới
#250 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/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ệ
javascript, node.js
Lĩnh vực
cli, tooling

Hướng nghiên cứu

Đọc site/check-links.mjs quanh các dòng 99–105 và site/lib/link-check.mjs quanh các dòng 54–63, sau đó theo dõi cách các cờ đã được phân tích truyền đến staleDaysFrom. Chạy các bài kiểm thử liên quan cho cả --stale-days=30 và --stale-days 30, cùng với một giá trị không hợp lệ. Hoàn thành khi cả hai dạng hợp lệ đều dùng mốc giới hạn 30 ngày và các giá trị không hợp lệ vẫn bị lỗi.

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 priority: low

Summary

check-links parses argv twice: the strict cliArgs parse accepts --stale-days=30, then staleDaysFrom(process.argv) scans for the exact token --stale-days, misses the = form and falls back to 365 days without a warning.

Where

  • site/check-links.mjs:99-105
  • site/lib/link-check.mjs:54-63 (staleDaysFrom)

Details

readArgs returns { "stale-days": "30" } while staleDaysFrom(['node','x','--stale-days=30']) returns { days: 365 }. This is the last script that still hand-parses argv after the strict-flags change.

Impact

A maintainer asking for a shorter staleness window locally silently gets the 365-day report. The weekly workflow passes no flag, so CI is unaffected.

Steps to reproduce

  1. node site/check-links.mjs --stale-days=30 --report r.md
  2. The stale list uses a 365-day cutoff.

Suggested fix

Validate the parsed value (flags["stale-days"]) in staleDaysFrom instead of re-reading process.argv, and drop the second parse.

Acceptance criteria

  • --stale-days=30 and --stale-days 30 both give a 30-day cutoff
  • Invalid values still fail as they do today

Getting started

  • Relevant files: site/check-links.mjs, site/lib/link-check.mjs
  • Run the tests: npm test; the full local gate is npm run check (Node 22+, no install step)
  • Related docs: CONTRIBUTING.md, site/README.md

Related: #82


Filed by repo-audit/full-audit at 4adb944. Severity: low. Effort: S. audit-key: bug|site/check-links.mjs|staleDaysFrom

Ngôn ngữ chính
JavaScript
Star
58
Fork
15
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
12

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/Free-Game-Dev-Assets

Tất cả issue của TMHSDigital/Free-Game-Dev-Assets

Issue tương tự

Thêm issue về JavaScript

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.