-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Open
Labels
actiongithub action yml imporvegithub action yml imporvegood first issueGood for newcomers 新手任务Good for newcomers 新手任务
Description
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
Metadata
Metadata
Assignees
Labels
actiongithub action yml imporvegithub action yml imporvegood first issueGood for newcomers 新手任务Good for newcomers 新手任务