Skip to content

Commit

Permalink
Merge pull request #1134 from yql70/main
Browse files Browse the repository at this point in the history
🐛修复luacheck在windows下处理结果异常的问题
  • Loading branch information
cyw3 authored Jul 17, 2024
2 parents 1fd4cfb + 79aff7c commit 9bf2b70
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions client/tool/luacheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,22 @@ def run_luacheck(self, scan_cmd, error_output, pos, rules):
issues = []
for file in raw_warning.iter(tag="testcase"):
# tag, attrib
path = file.attrib.get("classname")[pos:]
path = file.attrib.get("classname")
for error in file.findall("failure"):
rule = error.attrib.get("type")
if rules and rule not in rules:
continue
# 2024/4/18 移除msg中的行列号信息
message = error.attrib.get("message")
if message is None:
if message is None or not message.startswith(path):
continue
infos = message.split(":", 3)
message = message[len(path)+1:]
infos = message.split(":", 2)
# msg中 on line 后面也会跟着行号
msg = infos[3].split("on line ")[0].strip()
line = int(infos[1])
column = int(infos[2])
issues.append({"path": path, "rule": rule, "msg": msg, "line": line, "column": column})
msg = infos[2].split("on line ")[0].strip()
line = int(infos[0])
column = int(infos[1])
issues.append({"path": path[pos:], "rule": rule, "msg": msg, "line": line, "column": column})
return issues


Expand Down

0 comments on commit 9bf2b70

Please sign in to comment.