style(ai-review 統計): 簡化嚴重等級數量表
This commit is contained in:
+4
-6
@@ -60,18 +60,16 @@ function countBy(findings, predicate) {
|
||||
return findings.filter(predicate).length;
|
||||
}
|
||||
|
||||
function buildReviewSummary(findings, commentable) {
|
||||
const unplacedCount = findings.length - commentable.length;
|
||||
function buildReviewSummary(findings) {
|
||||
const criticalCount = countBy(findings, f => f.level === 'critical');
|
||||
const warningCount = countBy(findings, f => f.level === 'warning');
|
||||
const infoCount = countBy(findings, f => f.level === 'info');
|
||||
return [
|
||||
'## AI Code Review 統計',
|
||||
'',
|
||||
'| 統計 | 統計 | 統計 |',
|
||||
'| 🔴 嚴重 | 🟡 警告 | 🔵 建議 |',
|
||||
'| --- | --- | --- |',
|
||||
`| **總問題**<br>${findings.length} 筆 | **可標註檔案與行數**<br>${commentable.length} 筆 | **無法標註檔案與行數**<br>${unplacedCount} 筆 |`,
|
||||
`| **🔴 嚴重**<br>${criticalCount} 筆 | **🟡 警告**<br>${warningCount} 筆 | **🔵 建議**<br>${infoCount} 筆 |`,
|
||||
`| ${criticalCount} 筆 | ${warningCount} 筆 | ${infoCount} 筆 |`,
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
@@ -93,7 +91,7 @@ export async function postFindingsReview(findings, deps = {}) {
|
||||
const { postReview = postPullReview } = deps;
|
||||
const sorted = [...findings].sort(bySeverity);
|
||||
const comments = sorted.map(toReviewComment).filter(Boolean);
|
||||
const body = buildReviewSummary(sorted, comments);
|
||||
const body = buildReviewSummary(sorted);
|
||||
await postReview({ body, comments });
|
||||
ok(`review 發布: total=${sorted.length} commentable=${comments.length}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user