Loading...
Loading...
Compare original and translation side by side
Review Progress:
- [ ] 1. Scan codebase: identify files to review
- [ ] 2. Check each dimension (naming, functions, DRY, YAGNI, magic numbers, clarity, conventions)
- [ ] 3. Rate severity (High/Medium/Low) for each issue
- [ ] 4. Generate report sorted by severity评审进度:
- [ ] 1. 扫描代码库: 确定需要评审的文件
- [ ] 2. 检查每个维度(命名、函数、DRY、YAGNI、魔术数字、代码清晰度、编码规范)
- [ ] 3. 为每个问题评定严重程度(高/中/低)
- [ ] 4. 生成按严重程度排序的评审报告data1tempresultinfoobjgetfetchretrieve// ❌
const d = new Date();
const data1 = fetchUser();
// ✅
const currentDate = new Date();
const userProfile = fetchUser();data1tempresultinfoobjgetfetchretrieve// ❌
const d = new Date();
const data1 = fetchUser();
// ✅
const currentDate = new Date();
const userProfile = fetchUser();// ❌ 7 parameters
function processOrder(user, items, address, payment, discount, coupon, notes)
// ✅ Use parameter object
interface OrderParams { user: User; items: Item[]; shipping: Address; payment: Payment }
function processOrder(params: OrderParams)// ❌ 7个参数
function processOrder(user, items, address, payment, discount, coupon, notes)
// ✅ 使用参数对象
interface OrderParams { user: User; items: Item[]; shipping: Address; payment: Payment }
function processOrder(params: OrderParams)if (config.legacyMode)// ❌ YAGNI violation: unused compatibility code
if (config.legacyMode) {
// 100 lines of compatibility code
}if (config.legacyMode)// ❌ 违反YAGNI原则:未使用的兼容代码
if (config.legacyMode) {
// 100行兼容代码
}// ❌
if (retryCount > 3) // What is 3?
setTimeout(fn, 86400000) // How long is this?
// ✅
const MAX_RETRY_COUNT = 3;
const ONE_DAY_MS = 24 * 60 * 60 * 1000;// ❌
if (retryCount > 3) // 3代表什么?
setTimeout(fn, 86400000) // 这是多长时间?
// ✅
const MAX_RETRY_COUNT = 3;
const ONE_DAY_MS = 24 * 60 * 60 * 1000;// ❌ Nested ternary
const status = a ? (b ? 'x' : 'y') : (c ? 'z' : 'w');
// ✅ Use switch or if/else
function getStatus(a, b, c) {
if (a) return b ? 'x' : 'y';
return c ? 'z' : 'w';
}// ❌ 嵌套三元运算符
const status = a ? (b ? 'x' : 'y') : (c ? 'z' : 'w');
// ✅ 使用switch或if/else
function getStatus(a, b, c) {
if (a) return b ? 'x' : 'y';
return c ? 'z' : 'w';
}// ❌ Inconsistent style
import { api } from './api'
import axios from 'axios' // External lib should come first
const handle_click = () => { ... } // Mixed naming style
// ✅ Unified style
import axios from 'axios'
import { api } from './api'
function handleClick(): void { ... }[!TIP] Project conventions should refer to,CLAUDE.md, or project-defined coding standards.AGENTS.md
// ❌ 风格不一致
import { api } from './api'
import axios from 'axios' // 外部库应放在前面
const handle_click = () => { ... } // 命名风格混合
// ✅ 统一风格
import axios from 'axios'
import { api } from './api'
function handleClick(): void { ... }[!TIP] 项目规范应参考、CLAUDE.md或项目定义的编码标准。AGENTS.md
| Level | Criteria |
|---|---|
| High | Affects maintainability/readability, should fix immediately |
| Medium | Room for improvement, recommended fix |
| Low | Code smell, optional optimization |
| 等级 | 判定标准 |
|---|---|
| 高 | 影响可维护性/可读性,需立即修复 |
| 中 | 有改进空间,建议修复 |
| 低 | 代码坏味道,可选优化 |
undefinedundefinedfile:lineundefinedfile:lineundefinedclean-code-review.mdclean-code-review.jsonclean-code-review.mdclean-code-review.json/review-clean-code --scope=components--dimension=naming/review-clean-code --scope=components--dimension=naming