diff --git a/app/comments.js b/app/comments.js index da84924..a6acfe2 100644 --- a/app/comments.js +++ b/app/comments.js @@ -109,8 +109,9 @@ function toReviewComment(f) { /** * 發布單一 Gitea review: - * - summaryFindings 只用來統計本文數字 - * - commentFindings 用來產生 review comments,並依嚴重等級排序 + * - summaryFindings 只用來統計本文數字(含新舊問題) + * - commentFindings 用來產生 review comments,並依嚴重等級排序; + * 只為新問題加上行內標註,舊問題(is_new === false)僅計入統計、不再重複標註檔案與行數 */ export async function postFindingsReview(findings, deps = {}) { const { @@ -120,7 +121,7 @@ export async function postFindingsReview(findings, deps = {}) { usageSection = '', } = deps; const sortedComments = [...commentFindings].sort(bySeverity); - const comments = sortedComments.map(toReviewComment).filter(Boolean); + const comments = sortedComments.filter(f => f.is_new !== false).map(toReviewComment).filter(Boolean); const body = buildReviewSummary(summaryFindings, usageSection); await postReview({ body, comments }); ok(`review 發布: summary=${summaryFindings.length} total=${sortedComments.length} commentable=${comments.length}`);