| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
Pre-Commit 规范整改 — 公共 Co-authored-by: gitcode_lijd<lijiandong20@huawei.com> # message auto-generated for no-merge-commit merge: !5305 merge refactor into master Pre-Commit 规范整改 — 公共 Created-by: gitcode_lijd Commit-by: gitcode_lijd Merged-by: cann-robot Description: pre-commit是一个Git Hooks框架,用于在 git commit时自动运行代码检查和格式化工具。: | Hook | 功能 | 说明 | |------|------|------| | **clang-format** | C/C++ 代码格式化 | 自动格式化代码,保持风格一致 | | **OAT Check** | 开源合规检查 | 检测许可证头、禁止二进制文件提交 | 本PR对于公共文件进行了pre-commit检查 See merge request: cann/ops-transformer!5305 | 9 天前 | |
Pre-Commit 规范整改 — 公共 Co-authored-by: gitcode_lijd<lijiandong20@huawei.com> # message auto-generated for no-merge-commit merge: !5305 merge refactor into master Pre-Commit 规范整改 — 公共 Created-by: gitcode_lijd Commit-by: gitcode_lijd Merged-by: cann-robot Description: pre-commit是一个Git Hooks框架,用于在 git commit时自动运行代码检查和格式化工具。: | Hook | 功能 | 说明 | |------|------|------| | **clang-format** | C/C++ 代码格式化 | 自动格式化代码,保持风格一致 | | **OAT Check** | 开源合规检查 | 检测许可证头、禁止二进制文件提交 | 本PR对于公共文件进行了pre-commit检查 See merge request: cann/ops-transformer!5305 | 9 天前 | |
Pre-Commit 规范整改 — 公共 Co-authored-by: gitcode_lijd<lijiandong20@huawei.com> # message auto-generated for no-merge-commit merge: !5305 merge refactor into master Pre-Commit 规范整改 — 公共 Created-by: gitcode_lijd Commit-by: gitcode_lijd Merged-by: cann-robot Description: pre-commit是一个Git Hooks框架,用于在 git commit时自动运行代码检查和格式化工具。: | Hook | 功能 | 说明 | |------|------|------| | **clang-format** | C/C++ 代码格式化 | 自动格式化代码,保持风格一致 | | **OAT Check** | 开源合规检查 | 检测许可证头、禁止二进制文件提交 | 本PR对于公共文件进行了pre-commit检查 See merge request: cann/ops-transformer!5305 | 9 天前 | |
Pre-Commit 规范整改 — 公共 Co-authored-by: gitcode_lijd<lijiandong20@huawei.com> # message auto-generated for no-merge-commit merge: !5305 merge refactor into master Pre-Commit 规范整改 — 公共 Created-by: gitcode_lijd Commit-by: gitcode_lijd Merged-by: cann-robot Description: pre-commit是一个Git Hooks框架,用于在 git commit时自动运行代码检查和格式化工具。: | Hook | 功能 | 说明 | |------|------|------| | **clang-format** | C/C++ 代码格式化 | 自动格式化代码,保持风格一致 | | **OAT Check** | 开源合规检查 | 检测许可证头、禁止二进制文件提交 | 本PR对于公共文件进行了pre-commit检查 See merge request: cann/ops-transformer!5305 | 9 天前 | |
Pre-Commit 规范整改 — 公共 Co-authored-by: gitcode_lijd<lijiandong20@huawei.com> # message auto-generated for no-merge-commit merge: !5305 merge refactor into master Pre-Commit 规范整改 — 公共 Created-by: gitcode_lijd Commit-by: gitcode_lijd Merged-by: cann-robot Description: pre-commit是一个Git Hooks框架,用于在 git commit时自动运行代码检查和格式化工具。: | Hook | 功能 | 说明 | |------|------|------| | **clang-format** | C/C++ 代码格式化 | 自动格式化代码,保持风格一致 | | **OAT Check** | 开源合规检查 | 检测许可证头、禁止二进制文件提交 | 本PR对于公共文件进行了pre-commit检查 See merge request: cann/ops-transformer!5305 | 9 天前 | |
pre-commit 补充license Co-authored-by: gitcode_lijd<lijiandong20@huawei.com> # message auto-generated for no-merge-commit merge: !5437 merge err_msg into master pre-commit 补充license Created-by: gitcode_lijd Commit-by: gitcode_lijd Merged-by: cann-robot Description: # ops-transformer 仓库 License 合规整改总结 ## 背景 ops-transformer 仓库在 pre-commit 流程中引入了 OAT(Open Source Audit Tool)合规性检查,用于扫描提交文件是否包含合规的 CANN License 头。在实际提交过程中,OAT 检查发现多个文件缺少 License 头,导致 commit 被阻断。为此进行了两笔提交来完成整改。 ## 提交记录 | 序号 | Commit | 提交信息 | 修改文件数 | 变更量 | |------|--------|----------|-----------|--------| | 1 | 7ad5476c9 | pre-commit 规则修改 | 1 | +10 / -1 | | 2 | 84b25cd9d | 补充license | 94 | +4399 / -3521 | ## 提交一:pre-commit 规则修改 ### 修改内容 对 .pre-commit-config.yaml 做了两处修改: 1. **补充 CANN License 头** — 该文件本身缺少 License,导致 OAT 检查报错 License Header Invalid 2. **codespell 排除范围扩展** — 在 --skip 参数中新增 *.md,避免对 Markdown 文档进行拼写检查(文档中包含大量技术术语和中文内容,误报率高) ### 触发原因 首次提交时 OAT 扫描结果: [OAT] Found 1 compliance issue(s): - Invalid File Type: 0 - License Header Invalid: 1 → .pre-commit-config.yaml (NoLicenseHeader) ## 提交二:补充 License ### 统计概览 - **涉及文件**: 94 个 - **文件类型分布**: | 类型 | 数量 | License 格式 | |------|------|-------------| | .py | 62 | # 注释风格 | | .sh | 14 | # 注释风格 | | .cpp | 8 | /**/ 注释风格 | | .h | 5 | /**/ 注释风格 | | .yml | 4 | # 注释风格 | | .yaml | 1 | # 注释风格 | - **模块分布**: | 模块 | 文件数 | |------|--------| | attention | 37 | | experimental | 31 | | examples | 7 | | .gitcode | 5 | | tests | 3 | | posembedding | 3 | | mc2 | 3 | | mhc | 2 | | torch_extension | 1 | | scripts | 1 | | ffn | 1 | ### License 头格式 #### Hash 风格(.sh / .py / .yaml / .yml) # ----------------------------------------------------------------------------------------------------------- # Copyright (c) 2025 Huawei Technologies Co., Ltd. # This program is free software, you can redistribute it and/or modify it under the terms and conditions of # CANN Open Software License Agreement Version 2.0 (the "License"). # Please refer to the License for details. You may not use this file except in compliance with the License. # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. # See LICENSE in the root of the software repository for the full text of the License. # ----------------------------------------------------------------------------------------------------------- #### C 风格(.cpp / .c / .h / .hpp) c /** * Copyright (c) 2025 Huawei Technologies Co., Ltd. * This program is free software, you can redistribute it and/or modify it under the terms and conditions of * CANN Open Software License Agreement Version 2.0 (the "License"). * Please refer to the License for details. You may not use this file except in compliance with the License. * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. * See LICENSE in the root of the software repository for the full text of the License. */ ### 处理规则 | 场景 | 处理方式 | |------|---------| | 普通文件无 License | 在文件顶部添加 License 头 | | 文件有 shebang(#!/bin/bash) | License 插入在 shebang 之后 | | 文件有编码声明(# -*- coding: utf-8 -*-) | License 插入在编码声明之后 | | License 最后一行与代码之间 | 保留一个空行分隔 | | C 风格 */ 后 | 保留一个空行分隔 | | 空 __init__.py(0 字节) | 不添加 License,保持原样 | | 已有小写 copyright 的文件 | 不重复添加(识别为已有 License) | ### 额外修复 #### 1. 双 License 清理 以下 3 个文件原本同时包含 CANN License 和 Apache 2.0 License,删除了 Apache 2.0 部分: - scripts/util/insert_op_info.py - examples/add_example/op_kernel_aicpu/add_example_aicpu.cpp - examples/add_example/op_kernel_aicpu/add_example_aicpu.h #### 2. 格式规范化 - 所有 C 风格文件 */ 后确保有空行 - 所有 Hash 风格文件 License 块 # --- 后确保有空行 - 修复了 2 个文件(golden.py、golden_src.py)License 后的空格行替换为真正的空行 ### 排除范围 以下目录/文件未做修改: - build/ — 构建产物 - .git/ — Git 内部文件 - third_party/ — 第三方依赖 - */3rd/ — 第三方子模块 - oat_reports/ — OAT 扫描报告 - torch_extension/build/ — 构建产物 - 空 __init__.py(0 字节)— Python 包标识文件,无需 License ## 验证结果 整改完成后,对提交中所有 94 个文件进行了 5 项检查: | 检查项 | 结果 | |--------|------| | 1. 是否包含 Copyright Huawei 标识 | 全部通过 | | 2. 是否存在重复 Copyright | 全部通过 | | 3. C 风格 */ 后是否有空行 | 全部通过 | | 4. Hash 风格 # --- 后是否有空行 | 全部通过 | | 5. shebang/encoding 是否保持在第 1 行 | 全部通过 | See merge request: cann/ops-transformer!5437 | 5 小时前 | |
Pre-Commit 规范整改 — 公共 Co-authored-by: gitcode_lijd<lijiandong20@huawei.com> # message auto-generated for no-merge-commit merge: !5305 merge refactor into master Pre-Commit 规范整改 — 公共 Created-by: gitcode_lijd Commit-by: gitcode_lijd Merged-by: cann-robot Description: pre-commit是一个Git Hooks框架,用于在 git commit时自动运行代码检查和格式化工具。: | Hook | 功能 | 说明 | |------|------|------| | **clang-format** | C/C++ 代码格式化 | 自动格式化代码,保持风格一致 | | **OAT Check** | 开源合规检查 | 检测许可证头、禁止二进制文件提交 | 本PR对于公共文件进行了pre-commit检查 See merge request: cann/ops-transformer!5305 | 9 天前 |