### Describe problem solved by the proposed feature 主线目前最新已经支持并合并了clang-format机制,相比较之前的.ignore_format.yml机制,现在需要统一替换为.clang-format-ignore机制(clang-format原生支持的机制),该功能用于指定clang-format工具应该跳过哪些文件或目录的格式化 ### Describe your preferred solution 需要完成两件事情: 1.在每个.ignore_format.yml位置,创建一个名为.clang-format-ignore文件,然后将其中的排除规则放到.clang-format-ignore文件中(注意语法规则) 2.将涉及到.ignore_format.yml文件机制的脚本统一修改为.clang-format-ignore机制,最终删除掉所有的.ignore_format.yml * https://github.com/RT-Thread/rt-thread/blob/master/tools/ci/format_ignore.py * https://github.com/RT-Thread/rt-thread/blob/master/tools/ci/file_check.py 下面是一个.clang-format-ignore文件的示例: ``` # .clang-format-ignore 文件功能说明: # 1. 用于指定clang-format工具应该跳过哪些文件或目录的格式化 # 2. 采用类似.gitignore的语法规则 # 3. 支持通配符模式和路径匹配 # 4. 文件位置通常放在项目根目录,clang-format会递归应用这些规则 # ===================== # 核心语法规则示例 # ===================== # 规则1: 精确目录匹配 - 忽略指定目录下的所有内容 /build/ # 规则2: 通配符*匹配 - 忽略所有以".o"结尾的文件 *.o # 规则3: 递归**匹配 - 忽略任意层级下的node_modules目录 **/node_modules/ # 规则4: 单字符?匹配 - 忽略类似".a", ".b"的单个字符扩展名 *.? # 规则5: 字符集[]匹配 - 忽略".a"和".b"文件 *.[ab] # 规则6: 模式组合 - 忽略src下所有子目录中的test文件夹 /src/**/test/ # 规则7: 相对路径模式 - 忽略当前目录下的临时文件 /tmp_* # 规则8: 注释用法 - 以#开头的行会被视为注释 # 这是一个注释示例 # 规则9: 文件类型排除 - 忽略所有Markdown文档 **/*.md # 规则10: 构建输出排除 - 忽略常见的构建输出目录 /out*/ /dist/ /target/ # 规则11: 第三方代码排除 - 忽略第三方依赖目录 /third_party/ /vendor/ # 规则12: 隐藏目录排除 - 忽略所有以点开头的目录 /.*/ ``` ### Describe possible alternatives _No response_
Activity
kurisaW commentedon Oct 7, 2025
只完成了瑞萨系列,其他部分还需要修改下,可以给新手贡献者来提交下PR
CYFS3 commentedon Oct 15, 2025
还未完成的BSP
feat: migrate .ignore_format.yml to .clang-format-ignore for acm32 BSP …
feat: migrate .ignore_format.yml to .clang-format-ignore for apm32 BSP …
feat: migrate .ignore_format.yml to .clang-format-ignore for at32 BSP R…
feat: migrate .ignore_format.yml to .clang-format-ignore for bouffalo…
16 remaining items
RSOC: feat: complete migration from .ignore_format.yml to .clang-form…
supperthomas commentedon Oct 20, 2025
这个改了之后,formatting.py 还生效吗?
kurisaW commentedon Oct 21, 2025
后面就不用formatting.py了,这个脚本格式化功能比较有限,我拓展过几次,但是很容易引起其他语法错误,所以决定引用clang-format这种比较成熟,支持语法比较完善的格式化工具,现在用户可以通过本地搭建clang-format环境或者提PR上来后,通过CI自动处理格式化(自动追加一条格式化commit)
supperthomas commentedon Oct 21, 2025
哦哦,好的。
supperthomas commentedon Oct 21, 2025
嗯,用一些比较成熟的通用的技术,bug会少一些。
supperthomas commentedon Oct 21, 2025
搞完之后,建议发些文档说明一下。如何使用
ComerLater commentedon Oct 25, 2025
强烈推荐这个哈
ComerLater commentedon Oct 25, 2025
需要注意的地方是在tools或者gihtub/actions里面调用了.ignore_format.yml文件,这块也需要一起同步更新