| Restrict clang-format hook to tests Co-authored-by: xun_zhuge<zhugexun@hisilicon.com> Co-authored-by: zhangyujia77<zhangyujia37@huawei.com> # message auto-generated for no-merge-commit merge: !3238 merge update_tests_clang_format into master Restrict clang-format hook to tests Created-by: xun_zhuge Commit-by: zhangyujia77;xun_zhuge Merged-by: cann-robot Description: ## 描述 本 PR 调整 clang-format 的 pre-commit 检查范围,并对当前纳入范围的测试代码执行了一次全量格式化。 主要改动: - 将 .pre-commit-config.yaml 中 clang-format hook 的 files 范围从所有 C/C++/Ascend C 源文件收敛到 tests/ 目录:^tests/.*\.(c|h|cpp|hpp|cc|hh|cxx|hxx|asc)$。 - 移除该 hook 原有的 exclude: ^build/|tests/third_party/,避免和新的 files 范围重复维护。 - 执行 pre-commit run clang-format --all-files,按当前 .clang-format 规则格式化 tests/ 下匹配的 1521 个文件。 - 修复 tests/api/tensor_api/stub/cce_stub.h 中一处宏续行格式不稳定的问题,避免 clang-format 每次运行都继续改同一段宏。 ## 关联的Issue 无 ## 测试 已完成以下验证: - pre-commit validate-config 通过。 - pre-commit run clang-format --files tests/api/tensor_api/stub/cce_stub.h 通过。 - pre-commit run clang-format --all-files 通过。 - 提交时 pre-commit hook 通过:clang-format Passed,OAT Compliance Check Passed。 - OAT 提交检查为增量模式,最终覆盖 1521 个暂存文件,日志显示 All checks passed。 - 推送到 zhugexun/update_tests_clang_format 时远端 Git hooks 检查通过。 ## 文档更新 无文档更新。 ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 fix: Bug 修复 - [ ] ✨ feat: 新功能 - [ ] ⚡ perf: 性能优化 - [ ] ♻️ refactor: 代码重构 - [ ] 🧪 test: 新增或修改测试 - [ ] 📝 docs: 文档更新 - [x] 🔧 ci: CI/CD 配置修改 - [ ] ↩️ revert: 回退 - [x] 🧹 chore: 其他,请具体描述 See merge request: cann/asc-devkit!3238 | 7 天前 |