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

未关闭 适合新手
#106 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
85/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
领域
cli, testing

调研方向

阅读 src/baseline.ts 中 applyBaseline 附近的代码,以及 src/cli.ts 第 364–380 行附近的代码,追踪范围缩小后的文件如何进入 baseline 统计。然后检查 test/cli.test.ts 并运行报告中的 --files 复现;完成标准是未运行 lint 的文件不计入过期项数量,且测试确认过期条目为零。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
TypeScript
星标
0
派生
6
平均合并
1 天 21 小时
30 天内合并 PR
8

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TMHSDigital/godot-correctness-mcp 的其他 Issue

查看 TMHSDigital/godot-correctness-mcp 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。