refactor(pbls/rbac): M11b-2c-T3 响应 QC #14 —— 删除 collect() 不可达分支 got is None and has_script 及重复 stat 变量 has_script(脚本存在性判断已下沉 _load_module_paths),py_compile OK,--check total=277 wildcard=0 aggregation_failures=0 PASS 不变

This commit is contained in:
agent.develop 2026-09-22 17:49:10 +08:00
parent 7515a8a255
commit 21efe866fa

View File

@ -248,8 +248,8 @@ def collect():
""" """
merged, notes, failures, conflicts = {}, [], [], [] merged, notes, failures, conflicts = {}, [], [], []
for mod in MODULES: for mod in MODULES:
script = os.path.join(WS_DIR, 'modules', mod, 'scripts', 'load_path.py') # 脚本存在性判断已下沉到 _load_module_paths()(got is None 即代表脚本缺失),
has_script = os.path.exists(script) # 此处不再重复 stat(M11b-2c-T3 QC 退回意见 #14:清理不可达死代码)。
got, err, failed = _load_module_paths(mod) got, err, failed = _load_module_paths(mod)
if mod == 'pbl_evidence': if mod == 'pbl_evidence':
@ -291,8 +291,8 @@ def collect():
notes.append('%s: aggregated %d paths%s' % (mod, len(got), tag)) notes.append('%s: aggregated %d paths%s' % (mod, len(got), tag))
if failed: if failed:
failures.append('%s: %s' % (mod, err)) failures.append('%s: %s' % (mod, err))
if got is None and has_script: # 注:此处无需再判 got is None —— 上方各分支在 got is None 时均已 continue
failures.append('%s: script exists but nothing aggregated' % mod) # (M11b-2c-T3 QC 退回意见 #14 删除的不可达分支)。
for c in conflicts: for c in conflicts:
notes.append('[conflict] ' + c) notes.append('[conflict] ' + c)