mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-12 02:37:45 +08:00
- Implemented orchestrator logic to manage code review phases, including state reading, action selection, and execution loop. - Defined state schema for review process, including metadata, context, findings, and execution tracking. - Created action catalog detailing actions for context collection, quick scan, deep review, report generation, and completion. - Established error recovery strategies and termination conditions for robust review handling. - Developed issue classification and quality standards documentation to guide review severity and categorization. - Introduced review dimensions with detailed checklists for correctness, security, performance, readability, testing, and architecture. - Added templates for issue reporting and review reports to standardize output and improve clarity.
215 lines
4.6 KiB
Markdown
215 lines
4.6 KiB
Markdown
# Quality Standards
|
|
|
|
代码审查质量标准。
|
|
|
|
## When to Use
|
|
|
|
| Phase | Usage | Section |
|
|
|-------|-------|---------|
|
|
| action-generate-report | 质量评估 | Quality Dimensions |
|
|
| action-complete | 最终评分 | Quality Gates |
|
|
|
|
---
|
|
|
|
## Quality Dimensions
|
|
|
|
### 1. Completeness (完整性) - 25%
|
|
|
|
**评估审查覆盖的完整程度**
|
|
|
|
| Score | Criteria |
|
|
|-------|----------|
|
|
| 100% | 所有维度审查完成,所有高风险文件检查 |
|
|
| 80% | 核心维度完成,主要文件检查 |
|
|
| 60% | 部分维度完成 |
|
|
| < 60% | 审查不完整 |
|
|
|
|
**检查点**:
|
|
- [ ] 6 个维度全部审查
|
|
- [ ] 高风险区域重点检查
|
|
- [ ] 关键文件覆盖
|
|
|
|
---
|
|
|
|
### 2. Accuracy (准确性) - 25%
|
|
|
|
**评估发现问题的准确程度**
|
|
|
|
| Score | Criteria |
|
|
|-------|----------|
|
|
| 100% | 问题定位准确,分类正确,无误报 |
|
|
| 80% | 偶有分类偏差,定位准确 |
|
|
| 60% | 存在误报或漏报 |
|
|
| < 60% | 准确性差 |
|
|
|
|
**检查点**:
|
|
- [ ] 问题行号准确
|
|
- [ ] 严重程度合理
|
|
- [ ] 分类正确
|
|
|
|
---
|
|
|
|
### 3. Actionability (可操作性) - 25%
|
|
|
|
**评估建议的实用程度**
|
|
|
|
| Score | Criteria |
|
|
|-------|----------|
|
|
| 100% | 每个问题都有具体可执行的修复建议 |
|
|
| 80% | 大部分问题有清晰建议 |
|
|
| 60% | 建议较笼统 |
|
|
| < 60% | 缺乏可操作建议 |
|
|
|
|
**检查点**:
|
|
- [ ] 提供具体修复建议
|
|
- [ ] 包含代码示例
|
|
- [ ] 说明修复优先级
|
|
|
|
---
|
|
|
|
### 4. Consistency (一致性) - 25%
|
|
|
|
**评估审查标准的一致程度**
|
|
|
|
| Score | Criteria |
|
|
|-------|----------|
|
|
| 100% | 相同问题相同处理,标准统一 |
|
|
| 80% | 基本一致,偶有差异 |
|
|
| 60% | 标准不太统一 |
|
|
| < 60% | 标准混乱 |
|
|
|
|
**检查点**:
|
|
- [ ] ID 格式统一
|
|
- [ ] 严重程度标准一致
|
|
- [ ] 描述风格统一
|
|
|
|
---
|
|
|
|
## Quality Gates
|
|
|
|
### Review Quality Gate
|
|
|
|
| Gate | Overall Score | Action |
|
|
|------|---------------|--------|
|
|
| **Excellent** | ≥ 90% | 高质量审查 |
|
|
| **Good** | ≥ 80% | 合格审查 |
|
|
| **Acceptable** | ≥ 70% | 基本可接受 |
|
|
| **Needs Improvement** | < 70% | 需要改进 |
|
|
|
|
### Code Quality Gate (Based on Findings)
|
|
|
|
| Gate | Condition | Recommendation |
|
|
|------|-----------|----------------|
|
|
| **Block** | Critical > 0 | 禁止合并,必须修复 |
|
|
| **Warn** | High > 3 | 需要团队讨论 |
|
|
| **Caution** | Medium > 10 | 建议改进 |
|
|
| **Pass** | 其他 | 可以合并 |
|
|
|
|
---
|
|
|
|
## Report Quality Checklist
|
|
|
|
### Structure
|
|
|
|
- [ ] 包含审查概览
|
|
- [ ] 包含问题统计
|
|
- [ ] 包含高风险区域
|
|
- [ ] 包含问题详情
|
|
- [ ] 包含修复建议
|
|
|
|
### Content
|
|
|
|
- [ ] 问题描述清晰
|
|
- [ ] 文件位置准确
|
|
- [ ] 代码片段有效
|
|
- [ ] 修复建议具体
|
|
- [ ] 优先级明确
|
|
|
|
### Format
|
|
|
|
- [ ] Markdown 格式正确
|
|
- [ ] 表格对齐
|
|
- [ ] 代码块语法正确
|
|
- [ ] 链接有效
|
|
- [ ] 无拼写错误
|
|
|
|
---
|
|
|
|
## Validation Function
|
|
|
|
```javascript
|
|
function validateReviewQuality(state) {
|
|
const scores = {
|
|
completeness: 0,
|
|
accuracy: 0,
|
|
actionability: 0,
|
|
consistency: 0
|
|
};
|
|
|
|
// 1. Completeness
|
|
const dimensionsReviewed = state.reviewed_dimensions?.length || 0;
|
|
scores.completeness = (dimensionsReviewed / 6) * 100;
|
|
|
|
// 2. Accuracy (需要人工验证或后续反馈)
|
|
// 暂时基于有无错误来估算
|
|
scores.accuracy = state.error_count === 0 ? 100 : Math.max(0, 100 - state.error_count * 20);
|
|
|
|
// 3. Actionability
|
|
const findings = Object.values(state.findings).flat();
|
|
const withRecommendations = findings.filter(f => f.recommendation).length;
|
|
scores.actionability = findings.length > 0
|
|
? (withRecommendations / findings.length) * 100
|
|
: 100;
|
|
|
|
// 4. Consistency (检查 ID 格式等)
|
|
const validIds = findings.filter(f => /^(CORR|SEC|PERF|READ|TEST|ARCH)-\d{3}$/.test(f.id)).length;
|
|
scores.consistency = findings.length > 0
|
|
? (validIds / findings.length) * 100
|
|
: 100;
|
|
|
|
// Overall
|
|
const overall = (
|
|
scores.completeness * 0.25 +
|
|
scores.accuracy * 0.25 +
|
|
scores.actionability * 0.25 +
|
|
scores.consistency * 0.25
|
|
);
|
|
|
|
return {
|
|
scores,
|
|
overall,
|
|
gate: overall >= 90 ? 'excellent' :
|
|
overall >= 80 ? 'good' :
|
|
overall >= 70 ? 'acceptable' : 'needs_improvement'
|
|
};
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Improvement Recommendations
|
|
|
|
### If Completeness is Low
|
|
|
|
- 增加扫描的文件范围
|
|
- 确保所有维度都被审查
|
|
- 重点关注高风险区域
|
|
|
|
### If Accuracy is Low
|
|
|
|
- 提高规则精度
|
|
- 减少误报
|
|
- 验证行号准确性
|
|
|
|
### If Actionability is Low
|
|
|
|
- 为每个问题添加修复建议
|
|
- 提供代码示例
|
|
- 说明修复步骤
|
|
|
|
### If Consistency is Low
|
|
|
|
- 统一 ID 格式
|
|
- 标准化严重程度判定
|
|
- 使用模板化描述
|