Skip to content

Commit 70334ff

Browse files
committed
Merge branch 'main' of https://github.com/cyw3/CodeAnalysis
2 parents e56297e + f5f69a8 commit 70334ff

110 files changed

Lines changed: 58 additions & 21 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ jobs:
2424
- name: Checkout Repo
2525
uses: actions/checkout@v3
2626

27+
# 下载二进制文件
28+
- name: Download Binary Files
29+
run: |
30+
set -ex
31+
pwd
32+
bash ./scripts/base/install_bin.sh
33+
2734
- name: Setup Node 16
2835
uses: actions/setup-node@v3
2936
with:

client/codepuppy.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ def __init__(self):
3737
self._params = CmdArgParser.parse_args()
3838
# 日志输出设置
3939
self.__setup_logger()
40+
# 打印版本信息
41+
self.__print_client_version()
4042

4143
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
4244
LogPrinter.info('running in a PyInstaller bundle')
@@ -49,6 +51,12 @@ def __init__(self):
4951
# 默认git配置
5052
GitConfig.set_default_config()
5153

54+
def __print_client_version(self):
55+
"""打印TCA客户端版本信息"""
56+
LogPrinter.info("=" * 39)
57+
LogPrinter.info(f"*** TCA Client v{settings.VERSION}({settings.EDITION.name} Beta) ***")
58+
LogPrinter.info("=" * 39)
59+
5260
def __setup_logger(self):
5361
"""日志打印配置
5462

client/settings/edition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ class Edition(Enum):
2828
# 版本号
2929
# ========================
3030
# puppy版本号,格式:浮点数,整数部分为8位日期,小数部分为编号(从1开始)
31-
VERSION = 20220907.1
31+
VERSION = 20240716.1

client/tool/luacheck.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,21 +131,22 @@ def run_luacheck(self, scan_cmd, error_output, pos, rules):
131131
issues = []
132132
for file in raw_warning.iter(tag="testcase"):
133133
# tag, attrib
134-
path = file.attrib.get("classname")[pos:]
134+
path = file.attrib.get("classname")
135135
for error in file.findall("failure"):
136136
rule = error.attrib.get("type")
137137
if rules and rule not in rules:
138138
continue
139139
# 2024/4/18 移除msg中的行列号信息
140140
message = error.attrib.get("message")
141-
if message is None:
141+
if message is None or not message.startswith(path):
142142
continue
143-
infos = message.split(":", 3)
143+
message = message[len(path)+1:]
144+
infos = message.split(":", 2)
144145
# msg中 on line 后面也会跟着行号
145-
msg = infos[3].split("on line ")[0].strip()
146-
line = int(infos[1])
147-
column = int(infos[2])
148-
issues.append({"path": path, "rule": rule, "msg": msg, "line": line, "column": column})
146+
msg = infos[2].split("on line ")[0].strip()
147+
line = int(infos[0])
148+
column = int(infos[1])
149+
issues.append({"path": path[pos:], "rule": rule, "msg": msg, "line": line, "column": column})
149150
return issues
150151

151152

client/util/zipmgr.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,24 @@ def decompress_by_7z(self, zip_file, path, print_enable=False):
119119
def decompress(self, zip_file, path):
120120
logger.info("zip模块执行解压操作...")
121121
# 20190927 bug-fixed, 防止在当前目录下删除当前目录,出现权限异常情况
122-
os.chdir("..")
123-
if os.path.exists(path):
124-
PathMgr().rmpath(path)
122+
cur_dir = os.getcwd()
123+
cur_dir_is_changed = False
124+
if PathMgr().format_path(cur_dir) == PathMgr().format_path(path):
125+
logger.info("Decompress dir is current dir, can not delete it directory, change to parent directory first.")
126+
# 如果要删除的是当前工作目录,先切换到上层目录,再删除
127+
os.chdir("..")
128+
cur_dir_is_changed = True
125129

126-
self.decompress_by_7z(zip_file, path, print_enable=True)
127-
128-
if os.path.exists(WORK_DIR):
129-
os.chdir(WORK_DIR)
130+
try:
131+
if os.path.exists(path):
132+
PathMgr().rmpath(path)
133+
134+
self.decompress_by_7z(zip_file, path, print_enable=True)
135+
finally:
136+
# 恢复进入到当前工作目录
137+
logger.info("Go back to the current working directory.")
138+
if cur_dir_is_changed and os.path.exists(cur_dir):
139+
os.chdir(cur_dir)
130140
return True
131141

132142
def subprocc_log(self, line):

doc/images/API的个人令牌.png

-32.5 KB
Binary file not shown.

doc/images/AddRule.png

-68.1 KB
Binary file not shown.

doc/images/AddRule2.png

-48.3 KB
Binary file not shown.

doc/images/AddRule3.png

-32.5 KB
Binary file not shown.

doc/images/Fork.png

-272 KB
Binary file not shown.

0 commit comments

Comments
 (0)