Skip to content
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

style: Adjust YAML IDE formatting and reformat .tekton/*.yaml #1515

Merged
merged 5 commits into from
May 22, 2024

Conversation

msugakov
Copy link
Contributor

@msugakov msugakov commented May 21, 2024

This is a follow up on a thread from #1492 (comment).
When I compared how yamls are formatted in stackrox/stackrox and stackrox/scanner, I noticed a difference:

  • stackrox/stackrox
list:
- item1
- item2
  • stackrox/scanner
list:
  - item1
  - item2

Turns out, we have a setting for stackrox/stackrox since this PR from June 2021. I remember seeing and reviewing it and also remember that I went on vacation despite it was a busy time standing up RHACS Operator for the first time. I did not have a chance to ask why Malte configured the setting this way and, unfortunately, he did not leave a justification in the PR.

However, YAML list items indentation applied in StackRox is consistent with how k8s resources are typically formatted, see for example https://kubernetes.io/docs/concepts/services-networking/network-policies/#networkpolicy-resource. That's the reason why, I think, it was selected.

I add this setting to stackrox/scanner as a style rule and apply it to the contents of .tekton/ directory. Other YAML files may be reformatted later by other colleagues. I don't want to mess them up myself :-)

Choosing a way to introduce the setting, two options came up:

  1. Use JetBrains per-project settings like I did here https://github.com/stackrox/rox/pull/7370.
  2. Use .editorconfig settings. The first attempt I remember is https://github.com/stackrox/rox/pull/8859 (here's how Tomek obtained contents).

JetBrains settings look custom and .gitignore rules are a bit scary.

.editorconfig settings are not much better because the one I use - ij_yaml_indent_sequence_value - is JetBrains "extension" and is simply absent in EditorConfig. EditorConfig is not sophisticated enough to support this level of formatting. That means, JetBrains products will respect the setting but not others.

In either case, VSCode users seem to be out of luck according to comments redhat-developer/vscode-yaml#172 so I can only sigh and hope someone who cares enough can dedicate time to research and find a solution for VSCode.

Note for reviewers: .tekton/*.yaml files were reformatted in GoLand using a command. I did not make any manual changes there.

Copy link

openshift-ci bot commented May 21, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@msugakov msugakov changed the title Unset Indent sequence value for GoLand/JetBrains* YAML formatter chore: Reformat .tekton/* yaml files with GoLand May 22, 2024
@msugakov msugakov changed the title chore: Reformat .tekton/* yaml files with GoLand chore: Adjust YAML IDE formatting and reformat .tekton/*.yaml May 22, 2024
@msugakov msugakov changed the title chore: Adjust YAML IDE formatting and reformat .tekton/*.yaml style: Adjust YAML IDE formatting and reformat .tekton/*.yaml May 22, 2024
@msugakov
Copy link
Contributor Author

/test e2e-tests

@msugakov
Copy link
Contributor Author

/test e2e-tests

msugakov added a commit to stackrox/collector that referenced this pull request May 22, 2024
Copy link

openshift-ci bot commented May 22, 2024

@msugakov: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-tests c0178b6 link false /test e2e-tests

Full PR test history. Your PR dashboard.

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-sigs/prow repository. I understand the commands that are listed here.

@msugakov msugakov merged commit 26f8cef into master May 22, 2024
32 of 37 checks passed
@msugakov msugakov deleted the misha/yaml-formatting-konflux branch May 22, 2024 14:40
msugakov added a commit to stackrox/collector that referenced this pull request May 22, 2024
msugakov added a commit to stackrox/collector that referenced this pull request May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants