pre-commit 门禁:trailing-whitespace 排除 CMSIS/HAL_Driver/Middlewares(CubeMX 重生成空白抖动)
This commit is contained in:
@@ -16,6 +16,14 @@ repos:
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
# 排除第三方库(CubeMX 重生成会带回行尾空白,避免每次重生成产生提交抖动);
|
||||
# 自研代码(Drivers/BSP、Src、Inc、App 等)不受影响
|
||||
exclude: |
|
||||
(?x)^(
|
||||
Drivers/CMSIS/|
|
||||
Drivers/STM32F4xx_HAL_Driver/|
|
||||
Middlewares/
|
||||
)
|
||||
- id: end-of-file-fixer
|
||||
- id: check-added-large-files
|
||||
- id: check-merge-conflict
|
||||
|
||||
@@ -30,6 +30,7 @@ STM32F407ZGTx @168MHz(HSE 8MHz → PLL M=4/N=168/P=2);**仅 Keil MDK-ARM v
|
||||
## 提交门禁(pre-commit)
|
||||
|
||||
- 任一失败即拦截:cppcheck(warning/performance/portability/style)+ C 代码规范机械检查 + U+FFFD 乱码检查 + gitlint;范围仅项目代码(第三方 `Lib/`/`Middlewares/`/CMSIS/HAL/`lftpd`/`dhara`/`MDK-ARM`/`test/` 排除;规范检查另排除 CubeMX 生成的 `Src/`/`Inc/`)
|
||||
- trailing-whitespace 钩子另排除 `Drivers/CMSIS/`、`Drivers/STM32F4xx_HAL_Driver/`、`Middlewares/`(2026-09-20:CubeMX 6.18 重生成带回行尾空白,每次重生成产生提交抖动;`Drivers/BSP/` 自研代码仍受检)
|
||||
- 提交信息:**单行中文标题 <100 字符**(gitlint),UTF-8 无 BOM + `git commit -F <文件>`(防终端转码破坏)
|
||||
- 代码规范 V1.0:小写下划线命名(`g_`/`s_`/`p_`/`a_` 前缀)、头文件保护宏 `XXX_H`、常量在右、文件头模块注释块 → `docs/代码规范/`
|
||||
- 全库扫描 `pre-commit run --all-files`;详见 `docs/代码规范/pre-commit使用说明.md`
|
||||
|
||||
Reference in New Issue
Block a user