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

未關閉 適合新手
#250 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
78/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
javascript, node.js
領域
cli, tooling

研究方向

閱讀site/check-links.mjs第99–105行附近和site/lib/link-check.mjs第54–63行附近的內容,接著追蹤已解析的旗標如何傳到staleDaysFrom。針對--stale-days=30和--stale-days 30兩種形式,以及一個無效值,執行相關測試。完成標準是兩種有效形式都使用30天的截止期限,而無效值仍會失敗。

由索引模型根據 Issue 內容生成。

描述

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

主要語言
JavaScript
星號
58
分支
15
平均合併
1 天 15 小時
30 天內合併 PR
12

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

TMHSDigital/Free-Game-Dev-Assets 的其他 Issue

查看 TMHSDigital/Free-Game-Dev-Assets 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。