--fix: overlap handling, flag combinations and failure modes are untested

未关闭
#111 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
72/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
testing

调研方向

Read src/lint/fixes.ts and the applyFixes tests in test/fixes.test.ts, then review writeFixes and its CLI tests in src/cli.ts and test/cli.test.ts. Run the documented npm run build && npm test command first. Add tests for the listed overlap, CLI flag, and failure cases; done means the tests pin the expected rewritten files, output, and exit codes.

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

描述

help wanted severity: medium testing

Summary

--fix writes user files, but its tests only cover the happy path. The overlap-handling branch in applyFixes, flag combinations, and failure modes are untested.

Where

  • src/lint/fixes.ts:28-31 (overlap skip, including the special case for two identical zero-width insertions)
  • src/cli.ts:233-253 (writeFixes), src/cli.ts:353-357
  • test/fixes.test.ts:83-95 (only roundTrip), plus one plain lint <root> --fix CLI test

Test cases to add

applyFixes:

  • Two findings whose edits overlap: only the first is applied, applied === 1.
  • Two identical zero-width insertions at the same offset: applied once.
  • An insertion at offset X plus a replacement starting at X: the insertion lands before the replacement.
  • Adjacent replacements [a,b] and [b,c]: both applied.
  • Non-ASCII and emoji before the fix range on the same line, and a leading BOM: output pinned. These work today; lock them in.

CLI:

  • --fix run twice: the second run applies 0 fixes and the files are unchanged.
  • --fix --files a.gd: only a.gd is rewritten, even though b.gd has a fixable finding.
  • --fix --changed-since HEAD: only changed files are rewritten.
  • --fix --baseline b.json: pin whether baselined findings are fixed, and that the exit code reflects only the new findings.
  • --fix --fail-on warning where only fixable warnings exist: exit 0 after the fix.
  • A suppressed fixable finding (# gdcorrect-ignore[missing-onready]) is not rewritten.
  • A read-only file (POSIX chmod 444): exit 2 with a clear message, and the other files' writes are reported. Or make the writes all-or-nothing.
  • --fix with --format pretty and --format sarif: the output reflects the rewritten files.

Getting started

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

Filed by repo-audit/full-audit at e836036. Severity: medium. Effort: M. audit-key: testing|src/lint/fixes.ts|applyFixes

主要语言
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 摘要。