Skip to content

Commit 05d0b21

Browse files
doc: Update doc for changes of config files
1 parent b301add commit 05d0b21

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ xlings install skills:mcpp-style-ref
3434

3535
### 使用项目的`.clang-format`
3636

37-
> 直接复制[.clang-format](), 或使用xlings进行安装
37+
> 直接复制[.clang-format](./config/.clang-format), 或使用xlings进行安装
3838
3939
```
4040
xlings install mcpp:clang-format
@@ -69,8 +69,9 @@ xlings install mcpp:clang-format
6969
- 3.4 [用 optional/expected 替代 int 错误码](./README.md#34-用-optionalexpected-替代-int-错误码)
7070
- 3.5 [RAII 资源管理](./README.md#35-raii-资源管理)
7171
- 四、配置文件
72-
- 4.0 [Clang-Format 配置](./clang-format.md)
73-
- 4.1 [Clang-Tidy 配置](./clang-tidy.md)
72+
- 4.0 [Clang-Format 配置](./README.md#40-Clang-Format-配置)
73+
- 4.1 [Clang-Tidy 配置](./README.md#41-Clang-Tidy-配置)
74+
- 4.2 [CI/CD 工作流配置](./README.md#42-cicd-工作流配置)
7475

7576
## 一、标识符命名风格
7677

@@ -800,10 +801,27 @@ struct AutoLog {
800801

801802
## 四、配置文件
802803

803-
本章包含两个常用工具的配置说明:`clang-format`(代码格式化)和 `clang-tidy`(静态检查)。详细文档见
804+
本章包含社区项目模板中一些常用工具的配置说明
804805

805-
- [Clang-Format 配置](./clang-format.md) — 代码格式化规则与示例。
806-
- [Clang-Tidy 配置](./clang-tidy.md) — 静态检查规则集合与示例。
806+
### 4.0 Clang-Format 配置
807+
808+
代码格式化规则与示例。
809+
810+
- [转到配置文档](./clang-format.md)
811+
812+
### 4.1 Clang-Tidy 配置
813+
814+
静态检查规则集合与示例。
815+
816+
- [转到配置文档](./clang-tidy.md)
817+
818+
### 4.2 CI/CD 工作流配置
819+
820+
项目提供了 GitHub Actions 工作流模板: [`config/workflows/code-format.yml`](./config/workflows/code-format.yml)
821+
822+
- `pull_request` / `push``main` 时自动执行 `clang-format --dry-run --Werror`,用于格式一致性检测。
823+
- 若检查失败,CI 会直接报错并给出提示,提醒开发者在本地执行 `clang-format -i`
824+
- 可手动触发 `workflow_dispatch`,并选择 `mode=fix`,自动格式化并回推提交(可选择式自动修复)。
807825

808826
---
809827

clang-format.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ void bar();
465465

466466
## 其他配置
467467

468-
下面列出一些常见的 `clang-format` 配置项以供参考(这些项也出现在仓库的 `.clang-format` 中):
468+
下面列出一些常见的 `clang-format` 配置项以供参考(这些项也出现在仓库的 `./config/.clang-format` 中):
469469

470470
- `SpacesInParentheses: false` — 括号内不额外加空格。
471471
- `AllowShortLoopsOnASingleLine: false` — 禁止单行循环。

clang-tidy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,4 +273,4 @@ int* p = nullptr;
273273
- `performance-unnecessary-value-param.AllowedTypes: ''`(不额外放行类型作为按值参数)
274274
- `misc-unused-parameters.IgnoreVirtual: true`(忽略虚函数重载中的未使用参数警告)
275275

276-
如需在项目中使用这些设置,可参考仓库根目录的 `.clang-tidy` 文件并按需调整以纳入 CI。
276+
如需在项目中使用这些设置,可参考仓库的 `./config/.clang-tidy` 文件并按需调整以纳入 CI。

0 commit comments

Comments
 (0)