-
Notifications
You must be signed in to change notification settings - Fork 136
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
Explore: ytt being able to emit comments #638
Conversation
@@ -1,10 +1,10 @@ | |||
resources: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-indented arrays is more or less a given with yaml formatting. would not be good to change that for our end users imho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-indented arrays is more or less a given with yaml formatting
From what I've seen, there is no clear consensus on the indentation of sequences:
-
from the spec:
"The amount of indentation is a presentation detail and must not be used to convey content information.
and also notes:
"Since people perceive the “-” indicator as indentation, nested block sequences may be indented by one less space to compensate,"
-
certain communities express indentation in their guides:
-
eslint lints non-indented sequences as an error.
-
the YAML library author weighs in as well:
The formatting in v2 was inconsistent in several ways with many edge cases. In v3 we've changed it to simply make it not special: every depth level is indented by the space amount of spacing, regardless of its type.
I understand that some people will be used to the old formatting, but on this basis alone it'd be hard to evolve anything.
... would not be good to change that for our end users imho...
I'm not sure.
On the one hand, the output of an upgraded version would not be syntactically identical, but it would semantically; so it's arguable.
One path is to give the user the option: if you want to output comments, sequences are indented; otherwise no change.
On the other hand, folks might be diff'ing text to determine if there are changes.
I'm unsure how common this is.
I'm currently thinking that the added value that comments can bring would outweigh any inconvenience.
What informs your humble opinion, here? What do you see?
May depend on go-yaml/yaml#749 getting addressed. From #carvel
|
a99ccbc
to
5961872
Compare
5961872
to
b4bc0f5
Compare
b4bc0f5
to
76ccbd9
Compare
d6959a1
to
22731c1
Compare
22731c1
to
760c7b1
Compare
- yaml.v3 author refuses to support special indentation for sequences; adjust tests containing arrays to indent. (see also: go-yaml/yaml#661)
760c7b1
to
7ddcdc7
Compare
Keeping the branch, but closing this PR, for now. |
Allowing eslint directives would be nice: |
This is a PR meant for exploration: what would be the consequences of ytt emitting comments?
Inspired by: https://hackmd.io/IqHKk9LgSkadtrhV0-qyjg