已合并
infra(pre-commit): 引入 pre-commit/OAT 检查体系 #41
infra(pre-commit): 引入 pre-commit/OAT 检查体系 #41
已合并
景明创建于 13 天前
景明
景明
13 天前

关联Issue https://gitcode.com/cann/cannbot-sentry/issues/14

背景

仓内无提交期检查(Issue #14)。引入 pre-commit + OAT 检查体系(skills-dev PR#191 已合入的同款实现,含批扫描修复/Left 口径等全部后续修订),经本仓 --all-files 全量实测校准。1 笔提交,8 文件 +953/-2。

改动清单

件 内容
.pre-commit-config.yaml 五套钩子:pre-commit-hooks(7 项,trailing-whitespace 保 md 硬换行)、clang-format v18.1.8、ruff v0.14.14(豁免 8 项、F 系列全启用)、codespell v2.4.1(只查 md+yaml)、OAT 合规(local hook)
OAT.xml Huawei 版权策略项 + yaml/yml/csv/png/mjs 豁免;本仓增:requirements*.txt、*.jsonl(数据文件)、.npmignore(点文件)头豁免;png、*.jsonl.gz(UT 固件压缩会话日志)、.npmignore 二进制豁免
scripts/oat_check.sh OAT 增量扫描:PR-range 自适应、done-marker 四守卫、120KB 自动分批 + 失败阻塞 + 数组传参、失败留证 pre-commit_reports/oat_result.txt
scripts/run_codespell.sh codespell 输出 tee 到 pre-commit_reports/codespell.log
scripts/format_cpp.sh C++ 批量格式化(目录不存在报错退出;本仓暂无可格式化文件)
.clang-format Google 基线 + PointerAlignment: Left(int* p 指针随类型)
docs/pre-commit_guide.md 使用指南(快速使用/排查/FAQ/存量债增量治理)
.gitignore 忽略 pre-commit_reports/

校准结果(--all-files 实测)

  • 私钥 / check-json / check-yaml:全过
  • codespell:14 命中中 afterAll/pressEnter 为 Jest/Playwright API 标识符(文档引述测试代码)入白名单,余 0
  • ruff:仅 24 条全真问题残留(E741 17/F841 6/F401 1),存量债
  • OAT:豁免非债务类后残留 159 条全真存量债(ts 89 / tsx 29 / sh 3 / txt 5 等缺头)——增量消化

验证

  • 本提交自身过全部钩子(含 OAT 分批真实扫描);yaml/xml/bash 语法全过
likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 景明 的贡献)
景明景明
13 天前 创建了 pull request,commit d25369d5
景明景明
13 天前 关联了issue:仓库缺乏 pre-commit 代码检查与开源合规体系
CANN-robot
CANN-robot成员
13 天前 评论:

Hi @gitcode_lijd, welcome to submitting your first PR to cannbot-sentry!

PR Merge Steps

1. CLA Signing

If the current PR label includes cann-cla/yes, it means you have signed the CLA and can proceed to the next step. If the label includes cann-cla/no, please sign the CLA first. If you have any questions, please refer to the FAQ.

2. CI Check

Please comment /compile to trigger the CI pipeline check. If the CI run is successful, the PR will be tagged with ci-pipeline-passed and you can proceed to the next step. If the CI run fails, the PR will be tagged with ci-pipeline-failed, please check the CI logs to fix the issues in the PR. If you have any questions, please refer to the FAQ.

3. Code Review

After CI passes, please refer to the PR Approval Progress and proactively @ the committers in the table to review the code. After approval, committers will comment /lgtm and /approve. Once the lgtm and approved labels are successfully added, the PR will be merged automatically.

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

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/cannbot-sentry ✅ 金炯, guanxinghua (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

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

likedislike
景明
景明
13 天前 评论:

compile

likedislike
景明景明
13 天前 预合并成功(commit_id: 77aaf65725e398324131660bbc32ea75a0ba3aa7)
CANN-robot
CANN-robot成员
13 天前 评论:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robot成员
13 天前 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
13 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
13 天前 添加了label:ci-pipeline-passed
jon_jin成员
13 天前 评论:

/approve

likedislike
jon_jin成员
13 天前 评论:

/lgtm

likedislike
CANN-robotCANN-robot成员
13 天前 添加了label:approved
guanxinghua成员
13 天前 评论:

/lgtm

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