MCPcopy Index your code
hub / github.com/Tencent/CodeAnalysis / fix_scan_result

Method fix_scan_result

client/node/localtask/serverquery.py:28–55  ·  view source on GitHub ↗

根据问题单实时状态,用 lintscan_result 修正 scan_result 中 lintscan 部分的数据 scan_result是原始扫描数据,lintscan_result是从问题列表页面实时获取的数据(部分问题已经经过用户手动处理) 注意1: 按规则类型分类的统计数据暂不更新,出于server查询效率考虑,实时数据暂未获取该部分数据,目前也暂未用到这部分数据作为红线判断 注意2: 如果总问题量超过1000条,出于server查询效率考虑,不会更新实时数据,此时实时数据未更新 :param sca

(scan_result, lintscan_result)

Source from the content-addressed store, hash-verified

26 """
27 @staticmethod
28 def fix_scan_result(scan_result, lintscan_result):
29 """
30 根据问题单实时状态,用 lintscan_result 修正 scan_result 中 lintscan 部分的数据
31 scan_result是原始扫描数据,lintscan_result是从问题列表页面实时获取的数据(部分问题已经经过用户手动处理)
32 注意1: 按规则类型分类的统计数据暂不更新,出于server查询效率考虑,实时数据暂未获取该部分数据,目前也暂未用到这部分数据作为红线判断
33 注意2: 如果总问题量超过1000条,出于server查询效率考虑,不会更新实时数据,此时实时数据未更新
34 :param scan_result:
35 :param lintscan_result:
36 :return:
37 """
38 # 先判空,没有开启代码检查的情况字段值会是None
39 if "lintscan" in scan_result and scan_result["lintscan"]:
40 # 将按类别分类的数据保存下来
41 category_detail = {
42 "current_scan": scan_result["lintscan"]["current_scan"]["active_category_detail"],
43 "total": scan_result["lintscan"]["total"]["category_detail"]
44 }
45 # 修正scan_result
46 scan_result["lintscan"]["issue_open_num"] = lintscan_result["current_scan"]["issue_open_num"]
47 scan_result["lintscan"]["issue_fix_num"] = lintscan_result["current_scan"]["issue_fix_num"]
48 scan_result["lintscan"]["current_scan"] = lintscan_result["current_scan"]
49 scan_result["lintscan"]["total"] = lintscan_result["total"]
50 # 将 category_detail 恢复回去
51 scan_result["lintscan"]["current_scan"]["active_category_detail"] = category_detail["current_scan"]
52 scan_result["lintscan"]["total"]["category_detail"] = category_detail["total"]
53 return scan_result
54 else:
55 return scan_result
56
57 @staticmethod
58 def query_result_by_revision(dog_server, server_url, repo_id, proj_id, revision,

Callers 2

query_resultMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected