From f9dfb96fe2d115fc5492a1252babd977232c529a Mon Sep 17 00:00:00 2001 From: ShawnDeng-code Date: Sat, 26 Jul 2025 22:12:27 +0800 Subject: [PATCH] fix: update template --- .../.yamlfmt.yaml | 51 ++++++------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/repo_scaffold/templates/template-python/{{cookiecutter.project_slug}}/.yamlfmt.yaml b/repo_scaffold/templates/template-python/{{cookiecutter.project_slug}}/.yamlfmt.yaml index befc482..d4f0d24 100644 --- a/repo_scaffold/templates/template-python/{{cookiecutter.project_slug}}/.yamlfmt.yaml +++ b/repo_scaffold/templates/template-python/{{cookiecutter.project_slug}}/.yamlfmt.yaml @@ -1,46 +1,25 @@ +doublestar: true yaml_files: - "**/*.yaml" - "**/*.yml" - ".yamlfmt" - - "!**/vendor/**" - - "!**/node_modules/**" -yaml_options: - # 文档末尾是否需要一个空行 - end_of_document: true - # 配置文档分隔符 - - document_start: false +exclude: + - "**/vendor/**" + - "**/node_modules/**" + - "repo_scaffold/templates/**" +formatter: + type: basic + # 控制换行符保留 - 设为 false 可能减少不必要的空行 + retain_line_breaks: false + # 只保留单个换行符,移除多余的空行 + retain_line_breaks_single: true + # 注释前的空格数 + pad_line_comments: 2 + # 去除行尾空白字符 + trim_trailing_whitespace: true # 行长度限制 - line_length: 100 # 缩进大小 - indentation: 2 # 是否保留引号 - preserve_quotes: true - # 对齐方式 - - alignment: - # 是否启用键值对齐 - enable: true - # 键和冒号之间的最小间隔 - - key_value: 1 - # 对齐后冒号和值之间的空格数 - - colon_value: 1 - # 数组格式化 - - array: - # 嵌套数组是否应该与父级对齐 - indent_nested: true - # 数组项与前导符号 - 之间的空格数 - - item_spacing: 1 - # 是否移除文档注释 - - strip_comments: false - # 是否保留文件开头的注释 - - preserve_header: true