name: “QE质量评估” description: “全面的质量门、指标分析和部署就绪性评估,用于持续质量保证。” trust_tier: 3 validation: schema_path: schemas/output.json validator_path: scripts/validate-config.json eval_path: evals/qe-quality-assessment.yaml
QE质量评估
目的
指导使用v3的质量评估能力,包括自动化质量门、指标聚合、趋势分析和部署就绪性评估。
激活时机
- 当评估代码质量时
- 当设置质量门时
- 当评估部署就绪性时
- 当跟踪质量指标时
- 当生成质量报告时
快速开始
# 运行质量评估
aqe quality assess --scope src/ --gates all
# 检查部署就绪性
aqe quality deploy-ready --environment production
# 生成质量报告
aqe quality report --format dashboard --period 30d
# 比较发布之间的质量
aqe quality compare --from v1.0 --to v2.0
代理工作流
// 综合质量评估
Task("评估代码质量", `
评估src/的质量:
- 代码复杂度(圈复杂度、认知复杂度)
- 测试覆盖率和变异分数
- 安全漏洞
- 代码异味和技术债务
- 文档覆盖率
生成质量分数和建议。
`, "qe-quality-analyzer")
// 部署就绪性检查
Task("检查部署就绪性", `
评估发布v2.1.0是否准备好用于生产:
- 所有测试通过
- 覆盖阈值满足
- 无关键漏洞
- 性能基准通过
- 文档已更新
提供通过/不通过建议。
`, "qe-deployment-advisor")
质量维度
1. 代码质量指标
await qualityAnalyzer.assessCode({
scope: 'src/**/*.ts',
metrics: {
complexity: {
cyclomatic: { max: 15, warn: 10 },
cognitive: { max: 20, warn: 15 }
},
maintainability: {
index: { min: 65 },
duplication: { max: 3 } // 百分比
},
documentation: {
publicAPIs: { min: 80 },
complexity: { min: 70 }
}
}
});
2. 质量门
await qualityGate.evaluate({
gates: {
coverage: { min: 80, blocking: true },
complexity: { max: 15, blocking: false },
vulnerabilities: { critical: 0, high: 0, blocking: true },
duplications: { max: 3, blocking: false },
techDebt: { maxRatio: 5, blocking: false }
},
action: {
onPass: '继续',
onFail: '阻止合并',
onWarn: '通知'
}
});
3. 部署就绪性
await deploymentAdvisor.assess({
release: 'v2.1.0',
criteria: {
testing: {
unitTests: '全部通过',
integrationTests: '全部通过',
e2eTests: '关键通过',
performanceTests: '基线满足'
},
quality: {
coverage: 80,
noNewVulnerabilities: true,
noRegressions: true
},
documentation: {
changelog: true,
apiDocs: true,
releaseNotes: true
}
}
});
质量分数计算
quality_score:
components:
test_coverage:
weight: 0.25
metrics: [statement, branch, function]
code_quality:
weight: 0.20
metrics: [complexity, maintainability, duplication]
security:
weight: 0.25
metrics: [vulnerabilities, dependencies]
reliability:
weight: 0.20
metrics: [bug_density, flaky_tests, error_rate]
documentation:
weight: 0.10
metrics: [api_coverage, readme, changelog]
scoring:
A: 90-100
B: 80-89
C: 70-79
D: 60-69
F: 0-59
质量仪表板
interface QualityDashboard {
overallScore: number; // 0-100
grade: 'A' | 'B' | 'C' | 'D' | 'F';
dimensions: {
name: string;
score: number;
trend: 'improving' | 'stable' | 'declining';
issues: Issue[];
}[];
gates: {
name: string;
status: 'pass' | 'fail' | 'warn';
value: number;
threshold: number;
}[];
trends: {
period: string;
scores: number[];
alerts: Alert[];
};
recommendations: Recommendation[];
}
CI/CD集成
# 流水线中的质量门
quality_check:
stage: verify
script:
- aqe quality assess --gates all --output report.json
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
artifacts:
reports:
quality: report.json
allow_failure:
exit_codes:
- 1 # 仅警告
协调
主要代理: qe-quality-analyzer, qe-deployment-advisor, qe-metrics-collector 协调器: qe-quality-coordinator 相关技能: qe-coverage-analysis, qe-security-compliance