diff options
| author | Andreas Kurth <github@akurth.de> | 2026-01-21 01:13:44 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-20 16:13:44 -0800 |
| commit | 143c1dffed15f1cab3eb06e148fe11224e39471c (patch) | |
| tree | 6ea5c35cc54db0ab4979708802b208ec97bf6e94 | |
| parent | 426616cf1799dbce89800ae2fe9f155311436503 (diff) | |
Remove --no-doc argument from yq-yaml formatter (#386)
The --no-doc argument removes existing document separators (---) from
yaml files. It is perfectly valid and common practice to use multiple
documents within a single file, e.g. in the kubernetes universe.
Formatting such files with --no-doc breaks their validity.
See also the prettier-yaml test, which preserves the document separator,
too.
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | apheleia-formatters.el | 2 | ||||
| -rw-r--r-- | test/formatters/samplecode/yq-yaml/out.yml | 1 | ||||
| -rw-r--r-- | test/formatters/samplecode/yq-yaml/test-dont-add-docsep/in.yml | 12 | ||||
| -rw-r--r-- | test/formatters/samplecode/yq-yaml/test-dont-add-docsep/out.yml | 12 |
5 files changed, 28 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cda2e9..51b6b9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog]. ## Unreleased ### Formatters +* Removed `--no-doc` argument from yq-yaml to avoid breaking + multi-document yaml files ([#386]). * Use clang-format for formatting Objective-C/C++ files ([#378]). * `bibtex-reformat` for BibTeX files. * `rubocop` changed to use `--force-exclusion` to obey exclusions in config diff --git a/apheleia-formatters.el b/apheleia-formatters.el index 53e7387..c98b790 100644 --- a/apheleia-formatters.el +++ b/apheleia-formatters.el @@ -238,7 +238,7 @@ (yq-xml . ("yq" "--prettyPrint" "--no-colors" "--input-format" "xml" "--output-format" "xml" (apheleia-formatters-indent nil "--indent"))) - (yq-yaml . ("yq" "--prettyPrint" "--no-colors" "--no-doc" + (yq-yaml . ("yq" "--prettyPrint" "--no-colors" "--input-format" "yaml" "--output-format" "yaml" (apheleia-formatters-indent nil "--indent"))) (zig-fmt . ("zig" "fmt" "--stdin"))) diff --git a/test/formatters/samplecode/yq-yaml/out.yml b/test/formatters/samplecode/yq-yaml/out.yml index 8b4f56d..e85025b 100644 --- a/test/formatters/samplecode/yq-yaml/out.yml +++ b/test/formatters/samplecode/yq-yaml/out.yml @@ -1,3 +1,4 @@ +--- - hosts: all tasks: - name: Get software for apt repository management. diff --git a/test/formatters/samplecode/yq-yaml/test-dont-add-docsep/in.yml b/test/formatters/samplecode/yq-yaml/test-dont-add-docsep/in.yml new file mode 100644 index 0000000..fe6f000 --- /dev/null +++ b/test/formatters/samplecode/yq-yaml/test-dont-add-docsep/in.yml @@ -0,0 +1,12 @@ +doc: v1 +meta: + title: t1 + sub: + - sub1: 42 + sub2: 3333 +doc: v1 +meta: + title: t2 + sub: + - sub1: 43 + sub2: 4444 diff --git a/test/formatters/samplecode/yq-yaml/test-dont-add-docsep/out.yml b/test/formatters/samplecode/yq-yaml/test-dont-add-docsep/out.yml new file mode 100644 index 0000000..b61f9b4 --- /dev/null +++ b/test/formatters/samplecode/yq-yaml/test-dont-add-docsep/out.yml @@ -0,0 +1,12 @@ +doc: v1 +meta: + title: t1 + sub: + - sub1: 42 + sub2: 3333 +doc: v1 +meta: + title: t2 + sub: + - sub1: 43 + sub2: 4444 |
