-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Format code blocks with prettier #3911
Conversation
This commit aims to standardize the formatting of code blocks. Most importantly, it fixes a few cases of invalid indentation. Most other changes are related to list indentation. Both 0 space and 2 space indentation has been used throughout the docs, while prettier prefers 2 space indentation.
|
Hi @eliasnorrby. Thanks for your PR. I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/kind documentation |
/release-note-none |
@eliasnorrby: you can only set the release note label to release-note-none if the release-note block in the PR body text is empty or "none". In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/release-note-none |
/ok-to-test |
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vdemeester The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Is it going to be an issue if the released YAML specs has a different sequence indentation format? Most of Go-based tool (kubectl/kustomize/ytt), they don't indent sequence in YAML. |
@zhouhaibing089 I'm not sure I understand your question. The released YAML specs does indent sequences. This PR only touches documentation, and, if anything, I think the indentation used throughout the docs should be consistent with Whether, on a larger scope, one should aim to use unindented sequences (like the tools you mention) sounds like another question. (But it's not like the kubernetes docs consistently use unindented sequences in their docs just because |
Yeah, you're right. :) My assumption is too strong. 🤦 Hmm, I actually take my comment back(as I realized that latest YQ does the indentation for sequence) - also mentioned in go-yaml/yaml#661. Over time, the tools which rely on go-yaml might eventually update to v3, and then sequence indentation will become normal (Hmm, it's a bit unfortunate to me). |
Oh, didn't know about |
/lgtm thanks @eliasnorrby, it will be great to have some automated tool for such fixes and instructions on how to use it 🙃 |
/test pull-tekton-alpha-integration-tests |
/test pull-tekton-pipeline-alpha-integration-tests |
/test pull-tekton-pipeline-alpha-integration-tests |
This PR aims to standardize the formatting of code blocks. Most importantly, it fixes a few cases of invalid indentation.
Most other changes are related to list indentation.
Changes
While reading the docs, I noticed a couple of issues and inconsistencies within code blocks. I asked myself whether this could be addressed in a somewhat automated manner, e.g. a script scanning files for code blocks and formatting them with something like
prettier
.I then wrote said script. It grew a little out of proportion, but it was fun. (Here it is)
I realize this may be deemed trivial, but having written the script and all, I thought I'd open this PR anyway.
Notable changes:
Incorrect indentation of collections
Change: These issues have been fixed.
Some blocks have incorrect indentation, like this one in
docs/tasks.md
at line 171:Inconsistent indentation of lists
Change: yaml lists are now indented
Some lists are 2 space indented:
Whereas others are 0 space indented:
Some blocks even mix the two. I'm not aware of a widespread preference for either. I certainly don't have one - I only wish for consistency. As it turns out,
prettier
prefers indenting lists. In building my formatting script, I would have liked to provide the option to enforce either, but prettier lacks a configuration option for this. I experimented with other means of formatting (i.e. ruamel.yaml) that prefer a 0 space indent, but they proved to cause too many other problems to be viable.Indicating excluded lines
I chose to use
# ...
over...
, since that's still validyaml
. That is:over
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)