修复cppcheck钩子YAML参数被逗号/空格拆坏导致钩子空转的问题

.pre-commit-config.yaml:
  - args 元素加引号,修正 YAML 流序列解析
  - 此前 --enable 只生效 warning 类别,-I 路径全部失效
  - 新增 --inline-suppr 启用行内抑制注释

App/sys_clock.c:
  - knownConditionTrueFalse 误报行内抑制
  - 闰年 diy=366 分支 cppcheck 数据流未跟踪

docs/pre-commit使用说明.md:
  - 补充 style 类别完整规则详解
  - 新增 YAML 引号陷阱排查方法、行内抑制用法
  - 修正 style 不阻断提交的错误论断
This commit is contained in:
2026-09-01 14:41:05 +08:00
parent 82fcc2b890
commit 0f0d191bf7
3 changed files with 126 additions and 15 deletions
+1
View File
@@ -105,6 +105,7 @@ static void unix_to_sd2506(uint32_t unix_secs, sd2506_time_t *p_sd_time)
if ((y % 4 == 0 && y % 100 != 0) || (y % 400 == 0)) {
diy = 366uLL;
}
// cppcheck-suppress knownConditionTrueFalse ; 闰年 diy=366 时 day_count 可能为 365
if (day_count < diy) break;
day_count -= diy;
y++;