detectors match text, not code: comments, string/template literals and regex literals are judged as code (M1)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 38/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- devtools, testing-qa
调研方向
Start by reading the listed detector files: zero-tolerance-strict.ts, no-explicit-any-non-null.ts, dead-code-elimination.ts, magic-number-prevention.ts, and code-duplication-control.ts; also inspect the existing CodeText.codeOnly implementation. Trace which detectors scan raw text and compare their results with the self-audit examples in the issue. Done means text inside comments and literals no longer triggers these detectors, with AST checks used where appropriate; the issue gives no specific test files or commands.
由索引模型根据 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
Many regex-based detectors run over the raw file text (or strip comments only), so words inside comments, message strings, template literals and regex literals count as code. In the self-audit this is the largest single source of false findings.
| law | examples (file:line) | share |
|---|---|---|
| Unit Test Quality | .then(, fetch(, setTimeout inside fixture strings: 0 of 22 / 18 / 6 flagged files make a real call |
≥59 of 661 |
| Absolute Zero Tolerance | `/console.(log | …)/and///(.*?)(TODO |
| No Explicit Any / Non-Null | only stripComments (no-explicit-any-non-null.ts:40); 'AWS::Serverless::Function' matches :Function; hasThresholds: Object.keys( matches : Object |
14 of 17 |
| No Double Cast | the text as unknown as in law prose |
3 of 16 |
| Dead Code Elimination | includes('debugger') on raw text (dead-code-elimination.ts:221); // prose containing function/const/let (:138-145); startsWith('return') matches returned: (:164) |
12 of 12 |
| Error Handling Completeness | await/then/fetch/addEventListener counted in comments and strings: 33 → 4 once comments and strings are removed | 29 of 33 |
| Data Encryption | crypto names anywhere in the file; the HTTP sub-check never strips comments | 28 of 29 |
| Magic Number | regex literals are skipped but their contents not blanked (magic-number-prevention.ts:224-227): {0,300} counted |
75 literals |
| Code Duplication | template literals normalised to STR (code-duplication-control.ts:194); => inside strings starts a block |
part of 16 |
Suggested direction
One shared "code only" view for every text detector: blank comments, string/template literals and regex literals before matching, from the TypeScript scanner when available (CodeText.codeOnly exists) and an explicit not-read note otherwise (see the separate issue on the silent fallback). Prefer AST node checks (CallExpression of fetch, AwaitExpression, DebuggerStatement, AsExpression chains) over substrings.
- 主要语言
- 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 天内回复