已合并
fix: 代码检视修复 #116
IceT_5创建于 26 天前
fix: 代码检视修复 #116
已合并
IceT_5创建于 26 天前
IceT_5
26 天前

当前PR是否有AI参与:

[x] 否

[ ] 是
__1. AI Agent 平台:
__2. AI 模型:
__3. Prompt上下文 :

PR功能描述 / 为什么需要这个合入**:

   对开源软件元数据工具进行代码review后,修改部分代码问题。

该PR关联的issue

(格式为fixes #<issue号>, 或者resolves #<issue号>): fixes #
纯代码优化,无功能变化,无issue

希望检视人员了解:

改动类型 / Change Type

测试信息 / Testing

检查清单 / Checklist

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 IceT_5 的贡献)
IIceT_5
26 天前 创建了 pull request,commit 9b2bc966
atomgit-bot
atomgit-bot
26 天前 评论:

变更摘要

本次PR是对开源软件元数据工具(OSSinfo_extraction)的代码检视修复,不涉及功能变更。主要聚焦于代码质量改进:修复资源清理逻辑、集中管理常量、去除 LICENSE_EXTENSIONS 中的冗余大小写变体、移除未使用的导入,以及统一代码格式(尾部空格、末尾换行符)。

主要改动

  • extract.py 资源清理逻辑加固:将 subprocess.run 调用包裹在 try/finally 块中,并将 shutil.rmtree(custom_tmp) 移入 finally 分支且添加 ignore_errors=True,确保无论 extractcode 执行成功或失败,临时目录都会被清理。

  • config.pyLICENSE_EXTENSIONS 去重:移除了 .GPL.APACHE.MIT.BSD.LGPL.MPL.OFL.CC0 等大写扩展名变体,因为许可证文件名匹配已采用大小写不敏感方式,这些大写条目是冗余的。

  • prerequisite.py 常量集中管理:将 EXPECTED_SCANCODE_VERSION 常量从 prerequisite.py 模块级定义移至 config.py,并通过 from .config import EXPECTED_SCANCODE_VERSION 导入,实现版本号常量的统一管理。

  • main.py CLI 参数检查简化:将 if "--guide" in sys.argv or "-g" in sys.argv: 改为仅检查 "--guide",移除了 -g 短选项对指南功能的触发支持。

  • 移除未使用的导入及格式统一:从 license_extraction.pyparse_and_duplication.py 中移除未使用的 import json;同时修复了 license_extraction.pymain.pyparse_and_duplication.pyprerequisite.pyreadme_opensource.py 中多处尾部空格和末尾缺失换行符的问题,以及 readme_opensource.py 中多余的 continue 语句。

likedislike
atomgit-bot
atomgit-bot
26 天前 评论:

代码审查

✅ 未发现问题

likedislike
CANN-robotCANN-robot成员
26 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
26 天前 评论:

Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.


PR Approval Progress

Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-cann/infrastructure 宋常霞, 李超然 (2/2) 宋常霞 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

IceT_5, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
songchangxia成员
2 天前 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
2 天前 添加了label:approved
李超然
李超然成员
2 天前 评论:

/lgtm

likedislike
CANN-robotCANN-robot成员
2 天前 添加了label:lgtm
CANN-robotCANN-robot成员
2 天前 合入了pull request