summaryrefslogtreecommitdiff
path: root/documentation
diff options
context:
space:
mode:
authorCYFS <[email protected]>2026-10-30 18:20:46 +0800
committerGitHub <[email protected]>2026-10-30 18:20:46 +0800
commitcbc19778d0ae5ef2533a28c0f62c6a399858010a (patch)
tree6a7696817dcbf3b8101fa9dbdcd85f3e7996cfd2 /documentation
parent506dbc6d6ae9b6abf5e7941bb322212b23d272c9 (diff)
[clang-format] Pin version 22.1.8 and format kernel sources (#11936)HEADmaster
* [clang-format] Pin formatter version to 22.1.8 * [clang-format] Adjust loop line breaks * [kernel] Format src with clang-format 22.1.8
Diffstat (limited to 'documentation')
-rw-r--r--documentation/7.contribution/coding_style_cn.md9
-rw-r--r--documentation/7.contribution/coding_style_en.md10
2 files changed, 19 insertions, 0 deletions
diff --git a/documentation/7.contribution/coding_style_cn.md b/documentation/7.contribution/coding_style_cn.md
index 0b975a2e65..5cd59bfe35 100644
--- a/documentation/7.contribution/coding_style_cn.md
+++ b/documentation/7.contribution/coding_style_cn.md
@@ -291,6 +291,15 @@ rt_timer + 动词短语的形式表示能够应用于 timer 对象的方法。
RT-Thread 现在使用 clang-format 作为统一的代码格式化工具。提交 C/C++、头文件及相关源文件前,请优先使用仓库根目录的 `.clang-format` 配置进行格式化,不要再使用与该配置不一致的手工排版或旧的 astyle 参数。
+统一使用 clang-format **22.1.8**,版本固定在 `tools/ci/requirements-format.txt`。本地开发、格式检查 CI 和手动格式化工作流使用同一版本,避免不同版本产生格式差异。在仓库根目录安装并确认版本:
+
+```shell
+python -m pip install -r tools/ci/requirements-format.txt
+clang-format --version
+```
+
+编辑器也应使用上述安装的 clang-format 可执行文件。
+
常用命令如下:
```shell
diff --git a/documentation/7.contribution/coding_style_en.md b/documentation/7.contribution/coding_style_en.md
index c1953ed0aa..5934604579 100644
--- a/documentation/7.contribution/coding_style_en.md
+++ b/documentation/7.contribution/coding_style_en.md
@@ -218,6 +218,16 @@ submitting C/C++ source files, header files, and related source files, format
them with the `.clang-format` configuration in the repository root. Do not use
manual formatting or old astyle parameters that conflict with this configuration.
+Use clang-format **22.1.8**, pinned in `tools/ci/requirements-format.txt`.
+Local development, format checks, and the manual formatting workflow use the
+same version to avoid formatting differences. Install it from the repository
+root and verify the version:
+
+ python -m pip install -r tools/ci/requirements-format.txt
+ clang-format --version
+
+Configure your editor to use the same installed clang-format executable.
+
Common commands:
clang-format -style=file -i path/to/file.c