Add YAML formatting options: compact array indent and document start marker#2167
Open
snarlysodboxer wants to merge 2 commits intogetsops:mainfrom
Open
Add YAML formatting options: compact array indent and document start marker#2167snarlysodboxer wants to merge 2 commits intogetsops:mainfrom
snarlysodboxer wants to merge 2 commits intogetsops:mainfrom
Conversation
199728a to
261dcc7
Compare
261dcc7 to
01780a3
Compare
Expose the Go yaml.v3 CompactSeqIndent() encoder setting, which treats '- ' as part of the indentation. With indent: 2, this produces sequences flush with their parent key, matching the style expected by yamlfmt and yamllint. Configurable via .sops.yaml or --compact-sequence-indent flag. Refs getsops#514, getsops#864, getsops#1066 Signed-off-by: david amick <david@davidamick.com>
Prepend '---' to YAML output when enabled, addressing tools like yamllint and ytt that often expect the document start marker. Configurable via .sops.yaml or --document-start-marker flag. Refs getsops#1158 Signed-off-by: david amick <david@davidamick.com>
01780a3 to
b298cc0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add two new YAML store configuration options that address long-standing formatting requests:
compact_array_indent- Treats the-array indicator as part of the indentation. Withindent: 2, this produces arrays flush with their parent key, matching the style used byKubernetes manifests and common YAML linters. Exposes yaml.v3's
CompactSeqIndent()encoder setting.document_start_marker- Prepends---to YAML output. SOPS currently strips this during encryption, which often breaks linting tools that need/want it, likeyamlfmt,yamllint, andytt.Both options can be set via
.sops.yamlor CLI flags:--compact-array-indent--document-start-markerCloses #514, closes #864, closes #1066, closes #1158
Added tests for: