init
This commit is contained in:
@@ -147,20 +147,41 @@ class FeishuNotifier:
|
||||
summary = result.get('summary', {})
|
||||
files_scanned = result.get('files_scanned', 0)
|
||||
total = summary.get('total', 0)
|
||||
|
||||
|
||||
if total > 0:
|
||||
detail_text = f"{tool_name}: 扫描 {files_scanned} 个文件,发现 {total} 个问题"
|
||||
else:
|
||||
detail_text = f"{tool_name}: 扫描 {files_scanned} 个文件,无问题"
|
||||
|
||||
|
||||
scan_details.append(detail_text)
|
||||
|
||||
# 检查是否为 PR 扫描
|
||||
pr_url = report.get('pr_url')
|
||||
target_branch = report.get('target_branch')
|
||||
|
||||
# 构建基本信息文本
|
||||
if pr_url and target_branch:
|
||||
# PR 扫描
|
||||
title = f"{status_icon} PR 代码质量扫描报告"
|
||||
basic_info = (f"**仓库:** `{report.get('repo_name', 'unknown')}`\n"
|
||||
f"**源分支:** `{report.get('branch', 'unknown')}` → **目标分支:** `{target_branch}`\n"
|
||||
f"**PR链接:** [查看PR]({pr_url})\n"
|
||||
f"**提交:** `{report.get('commit_id', 'unknown')}`\n"
|
||||
f"**提交者:** {report.get('author', 'unknown')}")
|
||||
else:
|
||||
# Push 扫描
|
||||
title = f"{status_icon} 代码质量扫描报告"
|
||||
basic_info = (f"**仓库:** `{report.get('repo_name', 'unknown')}`\n"
|
||||
f"**分支:** `{report.get('branch', 'unknown')}`\n"
|
||||
f"**提交:** `{report.get('commit_id', 'unknown')}`\n"
|
||||
f"**提交者:** {report.get('author', 'unknown')}")
|
||||
|
||||
# 构建卡片消息
|
||||
card = {
|
||||
"header": {
|
||||
"title": {
|
||||
"tag": "plain_text",
|
||||
"content": f"{status_icon} 代码质量扫描报告"
|
||||
"content": title
|
||||
},
|
||||
"template": theme_color
|
||||
},
|
||||
@@ -169,10 +190,7 @@ class FeishuNotifier:
|
||||
"tag": "div",
|
||||
"text": {
|
||||
"tag": "lark_md",
|
||||
"content": f"**仓库:** `{report.get('repo_name', 'unknown')}`\n"
|
||||
f"**分支:** `{report.get('branch', 'unknown')}`\n"
|
||||
f"**提交:** `{report.get('commit_id', 'unknown')}`\n"
|
||||
f"**提交者:** {report.get('author', 'unknown')}"
|
||||
"content": basic_info
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user