Bare gdcorrect-ignore that silences a scene finding is reported as unused-suppression

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

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

Start by reading src/lint/suppressions.ts and the lint and scene reporting flow in src/lint/engine.ts and src/scenes/report.ts; then inspect test/suppressions.test.ts and run npm run build && npm test. Trace how bare directives are counted across lint and scene findings. Done means the repro no longer reports a matched bare directive as unused, unmatched bare directives still are reported, and the node-path suggestion names scene-node-path-missing.

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

描述

bug severity: medium

Summary

A bare # gdcorrect-ignore (no rule list) in a .gd file that silences a scene or project finding is reported by the lint pass as unused-suppression. The tool's own suggestion for scene-node-path-missing tells users to write exactly that comment.

Where

  • src/lint/suppressions.ts:82 (the out-of-scope exemption only applies when d.rules is non-null)
  • src/lint/engine.ts:32-40
  • src/scenes/node-paths.ts:119 (suggestion: "suppress with # gdcorrect-ignore")
  • src/scenes/input-actions.ts:89

Details

if (d.used) continue;
if (d.rules && [...d.rules].every(outOfScope)) continue;   // bare directive: rules === null -> reported

The scene passes honor the directive with reportUnused=false. The lint pass never sees those scene findings, so it treats the bare directive as unused.

Impact

Following the tool's advice produces a new finding. report shows unused-suppression for a directive that did suppress something, and --fail-on info (or a severity override on that rule) fails the run. Introduced with 2e316b6.

Steps to reproduce

  1. In a scene-attached script main.gd, inside _ready, add $Spawned.show() # gdcorrect-ignore (where Spawned is not in the scene) and if Input.is_action_pressed("jmp"): # gdcorrect-ignore.
  2. Run gdcorrect report <project> --format pretty. Both lines get INFO unused-suppression, and the scene findings are (correctly) hidden.

Suggested fix

Pick one:

  • Do the unused-suppression bookkeeping once per file over the combined lint and scene/project findings.
  • Have the lint pass leave bare directives on lines containing a node-path literal or an input-action call unreported.

In either case, change the node-path suggestion to recommend # gdcorrect-ignore[scene-node-path-missing].

Acceptance criteria

  • The repro produces no unused-suppression findings.
  • A bare directive that matches nothing in any pass is still reported.

Getting started

  • Relevant files: src/lint/suppressions.ts, src/lint/engine.ts, src/scenes/report.ts, test/suppressions.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: bug|src/lint/suppressions.ts|applySuppressions

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