From 348036aea3f3ecb0a838a3064fe6934bfe13355a Mon Sep 17 00:00:00 2001 From: Jeffery Date: Tue, 23 Jun 2026 13:15:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(ai-review=20=E7=B5=B1=E8=A8=88):=20?= =?UTF-8?q?=E7=B5=B1=E8=A8=88=E8=A1=A8=E6=94=B9=E7=82=BA=E5=9B=9B=E6=AC=84?= =?UTF-8?q?=EF=BC=88=E5=90=AB=E7=84=A1=E6=B3=95=E6=A8=99=E7=A4=BA=EF=BC=89?= =?UTF-8?q?=E4=B8=A6=E5=88=86=E6=96=B0=E8=88=8A=E5=85=A9=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/comments.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/comments.js b/app/comments.js index 25e2642..da84924 100644 --- a/app/comments.js +++ b/app/comments.js @@ -64,24 +64,27 @@ function newFindingsOnly(findings) { return findings.filter(f => f.is_new !== false); } +// 等級無法歸入 critical/warning/info(例如缺漏或無法辨識)時,歸入「無法標示」 +const isUnclassified = f => !LEVEL_ORDER.includes(f.level); + export function formatFindingsStats(findings) { const oldFindings = findings.filter(f => f.is_new === false); const newFindings = newFindingsOnly(findings); - const row = (label, items) => `| ${label} | ${countBy(items, f => f.level === 'critical')} 筆 | ${countBy(items, f => f.level === 'warning')} 筆 | ${countBy(items, f => f.level === 'info')} 筆 |`; + const row = (label, items) => `| ${label} | ${countBy(items, f => f.level === 'critical')} 筆 | ${countBy(items, f => f.level === 'warning')} 筆 | ${countBy(items, f => f.level === 'info')} 筆 | ${countBy(items, isUnclassified)} 筆 |`; return [ - '| 類型 | 🔴 嚴重 | 🟡 警告 | 🔵 建議 |', - '| --- | --- | --- | --- |', - row('舊問題', oldFindings), + '| 類型 | 🔴 嚴重 | 🟡 警告 | 🔵 建議 | ⚪ 無法標示 |', + '| --- | --- | --- | --- | --- |', row('新問題', newFindings), + row('舊問題', oldFindings), ].join('\n'); } export function formatFindingsStatsLine(findings) { const oldFindings = findings.filter(f => f.is_new === false); const newFindings = newFindingsOnly(findings); - const row = items => `嚴重${countBy(items, f => f.level === 'critical')} / 警告${countBy(items, f => f.level === 'warning')} / 建議${countBy(items, f => f.level === 'info')}`; - return `舊: ${row(oldFindings)};新: ${row(newFindings)}`; + const row = items => `嚴重${countBy(items, f => f.level === 'critical')} / 警告${countBy(items, f => f.level === 'warning')} / 建議${countBy(items, f => f.level === 'info')} / 無法標示${countBy(items, isUnclassified)}`; + return `新: ${row(newFindings)};舊: ${row(oldFindings)}`; } function buildReviewSummary(findings, usageSection = '') {