mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-04 08:13:30 +08:00
docs(zh-CN): sync Chinese docs with latest upstream changes
This commit is contained in:
40
docs/zh-CN/rules/cpp/hooks.md
Normal file
40
docs/zh-CN/rules/cpp/hooks.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
paths:
|
||||
- "**/*.cpp"
|
||||
- "**/*.hpp"
|
||||
- "**/*.cc"
|
||||
- "**/*.hh"
|
||||
- "**/*.cxx"
|
||||
- "**/*.h"
|
||||
- "**/CMakeLists.txt"
|
||||
---
|
||||
|
||||
# C++ 钩子
|
||||
|
||||
> 本文档基于 [common/hooks.md](../common/hooks.md) 扩展了 C++ 相关内容。
|
||||
|
||||
## 构建钩子
|
||||
|
||||
在提交 C++ 更改前运行以下检查:
|
||||
|
||||
```bash
|
||||
# Format check
|
||||
clang-format --dry-run --Werror src/*.cpp src/*.hpp
|
||||
|
||||
# Static analysis
|
||||
clang-tidy src/*.cpp -- -std=c++17
|
||||
|
||||
# Build
|
||||
cmake --build build
|
||||
|
||||
# Tests
|
||||
ctest --test-dir build --output-on-failure
|
||||
```
|
||||
|
||||
## 推荐的 CI 流水线
|
||||
|
||||
1. **clang-format** — 代码格式化检查
|
||||
2. **clang-tidy** — 静态分析
|
||||
3. **cppcheck** — 补充分析
|
||||
4. **cmake build** — 编译
|
||||
5. **ctest** — 使用清理器执行测试
|
||||
Reference in New Issue
Block a user