without a loadable typescript, CodeText.codeOnly silently falls back to a regex and an error-severity law changes its verdict
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- testing-qa
调研方向
Start with src/utils/code-text.ts around lines 58–64 and inspect how codeOnly handles a missing TypeScript parser; then check the laws that consume it and tsx-source.ts around line 48. Reproduce the reported verdict difference with and without TypeScript installed. Done when missing parser availability no longer silently changes an error-severity law’s verdict, and the not-read message correctly describes .ts files.
由索引模型根据 Issue 内容生成。
描述
Found in the 8.0.0 self-audit triage: RoC 7.29.1 (npm, 5fc54afe) on a clean clone of develop at 2d2fa9a, with typescript resolvable (verdict compliance, 0 failed / 46 warnings). The bucket method and per-law tables are kept by QA; counts are from that run.
What happens
CodeText.codeOnly (src/utils/code-text.ts:58-64) uses the TypeScript parser to blank strings and comments, and silently falls back to stripCommentsAndStrings when no typescript can be loaded: if (!ts) return this.stripCommentsAndStrings(content);. Its own comment says the regex "loses its place on nested quotes … a test file that keeps fixtures as source strings is exactly that shape".
Same clone, same RoC 7.29.1, only the presence of typescript differs:
| no typescript | typescript resolvable | |
|---|---|---|
| verdict / exit | failed / 1 | compliance / 0 |
| failed / warnings | 2 / 48 | 0 / 46 |
| Test Isolation Enforcement (error) | FAIL, 2 (it.only, localStorage, fetch( inside fixture strings) |
pass |
| Test Documentation Requirements | 167 unclear titles (fixtures) | 1 |
| Test Data Management | 4 | 3 |
Laws that load typescript themselves say so honestly ("could not load the 'typescript' package … NOT read"), but the regex-fallback laws give a different, stricter verdict with no note. typescript is not a dependency of ruleofcode, so the verdict of an error-severity law depends on whether the audited project happens to have typescript installed.
Related: the not-read message says ".tsx/.jsx files were NOT read" for plain .ts files (tsx-source.ts:48); Independent Awaits reports "read 0 of 78 files" as an ordinary failure, not judged nothing.
Suggested direction
Either make typescript a dependency of ruleofcode (the parser path then always exists), or make codeOnly report not-read instead of falling back, so a law that could not separate code from text says so (partial) instead of judging fixtures. Fix the message wording for .ts.
- 主要语言
- TypeScript
- 星标
- 0
- 派生
- 0
- 平均合并
- 38 分钟
- 30 天内合并 PR
- 96
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Rule-Of-Code/RoC 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
Rule-Of-Code/RoC#436 ·
维护者通常 1 天内回复
-
bug
难度 5/5 一周以上 新手友好度 35/100
Rule-Of-Code/RoC#439 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 49/100
Rule-Of-Code/RoC#438 ·
维护者通常 1 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 53/100
Rule-Of-Code/RoC#437 ·
维护者通常 1 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 74/100
Rule-Of-Code/RoC#435 ·
维护者通常 1 天内回复
相似的 Issue
-
ready-for-agent
难度 1/5 1 小时以内 新手友好度 86/100
LucasSantana-Dev/Lucky#3257 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
XiaomiMiMo/MiMo-Code#2849 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
danielmiessler/LifeOS#2894 ·
维护者通常 5 天内回复
-
enhancement frontend good first issue help wanted testing-infrastructure
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 2 天内回复
-
enhancement follow-up
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复