MCPcopy Create free account
hub / github.com/Tencent/CodeAnalysis / _format_issue

Method _format_issue

client/tool/util/tscan.py:67–91  ·  view source on GitHub ↗
(self, output_file)

Source from the content-addressed store, hash-verified

65 return issues
66
67 def _format_issue(self, output_file):
68 issues = []
69 try:
70 result_tree = ET.parse(output_file)
71 except ET.ParseError:
72 raise AnalyzeTaskError("源文件编码格式错误,建议启用WrongEncoding规则检测源文件编码格式")
73 root = result_tree.getroot()
74 for error in root:
75 error_attr = error.attrib
76 path = error_attr["file"]
77 if not path:
78 continue
79 rule = error_attr["subid"]
80 if not rule or rule not in self.rules:
81 continue
82 issues.append(
83 {
84 "path": path[self.relpos :],
85 "rule": rule,
86 "line": int(error_attr.get("line", "0")),
87 "column": "1",
88 "msg": error_attr.get("msg", ""),
89 }
90 )
91 return issues
92
93
94if __name__ == "__main__":

Callers 1

analyzeMethod · 0.95

Calls 3

AnalyzeTaskErrorClass · 0.90
parseMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected