missing-onready --fix writes @onready @export, and misses @onready above a comment
维护者通常 2 天内回复
@mafujahmedridoy22-commits 已经在做这个了。
开始于 2026年11月14日。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 88/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- tooling
调研方向
从 src/lint/rules/missing-onready.ts 开始,检查 hasOnready 以及发现问题和修复的逻辑;然后阅读 test/fixes.test.ts 和 test/rules.test.ts 中的相关用例。按照 issue 中的说明运行 npm run build && npm test。完成标准是:处理 @onready 和 var 之间的注释;导出的声明不应用修复且保持字节级完全一致;普通声明仍能得到修复。
由索引模型根据 Issue 内容生成。
描述
Summary
The machine-applicable fix for missing-onready writes wrong code in two cases. gdcorrect lint --fix writes it to user files.
- On an exported member,
@export var x: Node = $Xbecomes@onready @export var x: Node = $X. Godot warns on@onreadycombined with@export(ONREADY_WITH_EXPORT). The initializer then runs after the inspector value is applied and overwrites it, so the designer's assignment is silently lost. A test currently asserts this rewrite as correct. - When a comment sits between a standalone
@onreadyline and thevar, the rule does not see the annotation. It reports a false positive, and--fixadds a second@onready.
Where
src/lint/rules/missing-onready.ts:29(hasOnready: thepreviousNamedSiblingwalk stops at the firstcommentnode)src/lint/rules/missing-onready.ts:42-55(finding and fix are emitted regardless of@export*annotations)test/fixes.test.ts:24-29(expects@onready @export var other: Node = $Other)
Details
@onready
# the player sprite
var a: Node = $A # flagged; --fix -> "@onready var a ..." (second @onready)
@export var c: Node = $C # --fix -> "@onready @export var c ..."
Tree-sitter comments are named nodes, so s.type === "annotation" || s.type === "annotations" ends the loop at the comment.
Impact
--fix is described as applying only machine-applicable fixes. Here it changes runtime behaviour (exported values overwritten at _ready) or produces a redundant annotation, in files the user did not review.
Steps to reproduce
- Put either snippet above in a project script.
- Run
gdcorrect lint <project> --fix, then inspect the file.
Suggested fix
- In
hasOnready, skipcommentsiblings while walking backwards. - When the declaration carries any
@export*annotation, attach nofix. Either keep the finding with a message suggesting an exportedNodePathor no initializer, or skip it. - Update
test/fixes.test.tsto expect no fix for exported members.
Acceptance criteria
-
@onready/ comment /var a = $Ais not flagged. -
@export var n: Node = $Nand@export_*variants have nofix, and--fixleaves those lines byte-identical. - Plain
var n: Node = $Nis still fixed.
Getting started
- Relevant files:
src/lint/rules/missing-onready.ts,test/fixes.test.ts,test/rules.test.ts - How to run tests:
npm run build && npm test
Filed by repo-audit/full-audit at e836036. Severity: medium. Effort: S. audit-key: bug|src/lint/rules/missing-onready.ts|missingOnready.fix
- 主要语言
- TypeScript
- 星标
- 0
- 派生
- 6
- 平均合并
- 1 天 21 小时
- 30 天内合并 PR
- 8
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TMHSDigital/godot-correctness-mcp 的其他 Issue
-
enhancement good first issue severity: medium
难度 2/5 1-3 小时 新手友好度 85/100
TMHSDigital/godot-correctness-mcp#123 ·
维护者通常 2 天内回复
-
dependencies good first issue severity: low
难度 2/5 1-3 小时 新手友好度 82/100
TMHSDigital/godot-correctness-mcp#116 ·
维护者通常 2 天内回复
-
bug good first issue severity: low
难度 2/5 1-3 小时 新手友好度 88/100
TMHSDigital/godot-correctness-mcp#107 ·
维护者通常 2 天内回复
-
bug good first issue severity: low
难度 2/5 1-3 小时 新手友好度 85/100
TMHSDigital/godot-correctness-mcp#106 ·
维护者通常 2 天内回复
-
bug good first issue severity: medium
难度 2/5 1-3 小时 新手友好度 84/100
TMHSDigital/godot-correctness-mcp#105 ·
维护者通常 2 天内回复
查看 TMHSDigital/godot-correctness-mcp 的全部 Issue
相似的 Issue
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P3
难度 2/5 1-3 小时 新手友好度 76/100
openclaw/openclaw#203385 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
nwverse/persona#12800 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 80/100
维护者通常 1 天内回复
-
[MCP]: page snapshots in .playwright-mcp/ are not git-ignored (.playwright-cli/ is, since #42318)未关闭
难度 2/5 1-3 小时 新手友好度 62/100
microsoft/playwright#44289 ·
维护者通常 1 天内回复
-
good first issue
难度 2/5 半天 新手友好度 65/100
维护者通常 1 天内回复