Files
easygoadmin-wiki/EasyGoAdmin_Gin_NaiveVue/zh/standards/code-review.md
T
2026-10-25 17:24:27 +08:00

49 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 12.7 代码审查清单
:::tip 建议遵守
审查按清单走:安全红线 → 契约影响 → 分层纪律 → 规约符合度。前四项任一不过即阻塞。
:::
## 阻塞项(必须过)
- [ ] **数据访问**:无裸 `*gorm.DB`;删除走软删;Raw 有场景注释([12.3](/zh/standards/data-access.html))
- [ ] **契约稳定**:dto json 标签名未意外变更;RouteSpec 路径/权限码变更已同步前端与菜单
- [ ] **错误处理**:业务错误原样上抛(无 wrap)、无吞错、无 handler 写响应
- [ ] **安全**:新接口有权限码声明;敏感信息(密码/Token)不入日志;无硬编码密钥
- [ ] **配置**:新增配置键同步 .env.example(check-config 可过)
## 规约项
- [ ] 模块四件套齐全、命名符合 [12.4](/zh/standards/module-code.html)
- [ ] handler 只有委托;逻辑在 service;差异进 ModuleSpec 声明/钩子
- [ ] 钩子无 HTTP/文件 IO、无 append
- [ ] 事务用 WithTrans 且回调内用入参 ctx
- [ ] 分页符合 [12.2](/zh/standards/pagination.html);响应信封符合 [12.1](/zh/standards/api-response.html)
- [ ] 字典/枚举显示走 SerializeMaps 或字典接口,无硬编码文案映射
- [ ] 注释按当前功能直述(无改造过程表述)
## 前端项
- [ ] api 模块 URL 不带 /api 前缀,命名与后端动作对应
- [ ] 按钮权限用 v-perm/v-perms,码值与菜单节点一致
- [ ] 表单字段与 dto json 名一致(全量提交语义)
- [ ] 未绕过 http 封装直接用 axios
## 测试与工程
- [ ] 新逻辑有配套测试(或说明为何不测)
- [ ] `make check` / 前端 type+lint 本地通过
- [ ] 生成器产物与模板改动同提交
- [ ] 提交信息符合 [12.5](/zh/standards/git.html)
## 审查沟通原则
- 挑刺对代码不对人;给出理由与替代方案
- 优先级:正确性 > 安全 > 契约 > 可读性 > 风格
- 争议收敛到规约文档——这次讨论的结论应能写进本章某页
## 相关
- [12.8 后端编码规范](/zh/standards/backend-code.html)
- [12.9 前端编码规范](/zh/standards/frontend-code.html)