diff options
| author | CYFS <[email protected]> | 2026-07-09 15:08:43 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2026-07-09 18:02:01 +0800 |
| commit | b245c1869ef151ddeaf181c14b51d25daa2bfa2e (patch) | |
| tree | 77ede143adfd43f4ab85fdc66b500af832910989 /documentation/7.contribution/coding_style_en.md | |
| parent | dd7da0fd799dd34dd0db781dcfdab7c4b2dedf39 (diff) | |
[docs]Update the contribution document
Diffstat (limited to 'documentation/7.contribution/coding_style_en.md')
| -rw-r--r-- | documentation/7.contribution/coding_style_en.md | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/documentation/7.contribution/coding_style_en.md b/documentation/7.contribution/coding_style_en.md index 6bb0abc91c..c1953ed0aa 100644 --- a/documentation/7.contribution/coding_style_en.md +++ b/documentation/7.contribution/coding_style_en.md @@ -211,16 +211,24 @@ When creating a new object, think twice on memory allocations: whether a static object could be created or it could only created dynamically on the heap. Allocations can be slower, but may be necessary in dynamic environments. -# 14. Use astyle to format the code automatically -parameters: --style=allman - --indent=spaces=4 - --indent-preproc-block - --pad-oper - --pad-header - --unpad-paren - --suffix=none - --align-pointer=name - --lineend=linux - --convert-tabs - --verbose +# 14. Format Code + +RT-Thread now uses clang-format as the unified code formatting tool. Before +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. + +Common commands: + + clang-format -style=file -i path/to/file.c + clang-format -style=file -i path/to/file.h + +When formatting files in batches, limit the command to files related to the +current change and avoid large unrelated formatting changes. If a subdirectory +has its own `.clang-format`, use the nearest configuration for files under that +directory. + +In addition to clang-format, keep source files encoded as UTF-8, use `\n` line +endings, remove trailing whitespace, and avoid committing unrelated formatting +changes produced by editors. |
