-
Notifications
You must be signed in to change notification settings - Fork 612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
templates: use yq's indentation style #1389
Comments
I think the "style" of yq is mostly related to bugs in the go-yaml library, maybe they can be addressed ? https://github.com/goccy/go-yaml Or possibly the issue is with the |
The idiosyncrasies here is that this document: # comment
foo: "x"
bar: y
baz: null
map:
- foo: 1
- bar: 2
- baz: 3 Gets reformatted, when piped through # comment
foo: "x"
bar: y
baz: null
map:
- foo: 1
- bar: 2
- baz: 3 Even though the first document is valid YAML. Basically, missing lines and extra indentation.
rules:
document-start: disable
indentation:
indent-sequences: false |
Yes, please!
I thought it was because of $ git log --pretty=format:"%h %ad %s" --date=short -5
f6f7691 2022-05-27 The Billion Dollar Mistake
00bbc09 2022-05-21 github: drop broken semgrep workflow
8f96da9 2022-05-21 Explicitly check the parser for errors on peek
539c8e7 2022-05-12 Fix decoding of merge tags.
496545a 2021-01-07 Improve inline comments on map keys (#656).
$ gh issue list
Showing 30 of 239 open issues in go-yaml/yaml
[...]
$ gh pr list
Showing 30 of 100 open pull requests in go-yaml/yaml
[...] There are many issues and several PRs about this regression. But this is rather slow-moving: I was thinking about trying to use one of the existing forks for now, e.g. from But it may require a fork of the fork, to make the v2 behaviour the default, as we don't want to modify the Note that according to the But that is also broken due to the go-yaml regression: |
The removal of empty lines might be a bug, but I assume the indentation of bullet point lists isn't likely to change in a future release of yq. |
This is a separate problem from fixing list indentation. Strangely I couldn't find any open issues about this behaviour, but I didn't try very hard.
Yeah, but we don't really care about Footnotes
|
EDIT: same issue, different library |
I don't really like copying external libraries to internal, like kustomize did here. Better to use go mod replace. I made a proof-of-concept, where I patched yaml v3 and then added a bool to the yq prefs for lima to use: Unfortunately that means having to carry patch branches, and rebase them with any new yaml/yq releases.
Should go under lima-vm organization, if this forking path is taken (instead of changing lima indents). |
|
That is possible, can also wait for kyaml to appear... |
The newlines are treated as a separator (between comments), so they are not actually included in the comment (nor elsewhere) That makes them missing in Node, and "disappear" when doing a round-trip yaml. It needs a similar boolean, to keep newlines in comments. |
Why is this necessary? Users who use So we would preemptively mangle the formatting, just to keep the diff small for users that likely don't care or even notice? |
Not just for --set; I want to use yq (or something else similar) for automating bumping up the templates. |
Thanks! I totally missed that, and I understand why this is necessary. But it means we don't need to modify the And the fixed fork probably wouldn't have to be kept in sync with upstream |
lima/pkg/yqutil/yqutil_test.go
Lines 30 to 55 in 2992029
Lots of users are expected to use
--set
(yq) soon, so I'd prefer to adopt yq's indentation style.Revert:
The text was updated successfully, but these errors were encountered: