getsops / getsops/sops

Preserve formatting of YAML files

Open
#864 11 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
23.1k
Forks
1.1k
Avg merge
1d 11h
Merged PRs (30d)
9

Description

Encrypting and decrypting:

array: [element1, element2]

Turns into:

array:
    - elemenet1
    - element2

Also, trailing comments seem to be moved above the line:

field: value  # trailing comment
# trailing comment
field: value

And empty linefeeds are lost:

field: value

field2: value
field: value
field2: value

I would assume there are other examples, too.

Would it be possible to preserve more of the original file's formatting?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue does not name implementation files or tests. Start by locating SOPS's YAML encryption/decryption round-trip handling and reproduce the reported examples, then inspect how sequences, trailing comments, and blank lines are parsed and emitted. Done means these formatting details remain intact after encryption and decryption.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.