From 0a4e98d7d415310c4bc8718bbe576bc03f54db3c Mon Sep 17 00:00:00 2001 From: cyw3 <2927096163@qq.com> Date: Thu, 18 Apr 2024 12:51:32 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20luacheck-=E7=A7=BB=E9=99=A4msg=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E8=A1=8C=E5=88=97=E5=8F=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cyw3 <2927096163@qq.com> --- client/tool/luacheck.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/client/tool/luacheck.py b/client/tool/luacheck.py index a4b41e2d5c..f31c0acda0 100644 --- a/client/tool/luacheck.py +++ b/client/tool/luacheck.py @@ -136,9 +136,15 @@ def run_luacheck(self, scan_cmd, error_output, pos, rules): rule = error.attrib.get("type") if rules and rule not in rules: continue - msg = error.attrib.get("message")[pos:] - line = int(msg.split(":")[1]) - column = int(msg.split(":")[2]) + # 2024/4/18 移除msg中的行列号信息 + message = error.attrib.get("message") + if message is None: + continue + msg = message.split(":")[3] + # msg中 on line 后面也会跟着行号 + msg = msg.split("on line ")[0] + line = int(message.split(":")[1]) + column = int(message.split(":")[2]) issues.append({"path": path, "rule": rule, "msg": msg, "line": line, "column": column}) return issues