Better deterministic formatting

Open
#71 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
go, yaml
Domain
cli, tooling

Research direction

Start from the existing yam formatting path and review how YAML scalar quoting and styles are selected. Use the quoted examples as cases to reproduce, then verify that running yam removes style-only changes without rewriting unrelated YAML content.

Written by the indexing model from the issue text.

Description

I love gofmt. I love that I don't ever think about formatting go code. The computer does it and I accept it.

I'm probably not the only one who has toyed with editing melange files with a program.

https://github.com/wolfi-dev/os/pull/29368 is an example PR that I made by editing melange yaml with ruamel. It does a pretty good job of not rewriting the whole thing (like 'yaml.dump' would do). But it still had some random changes like :

-     3.10: "310"
-     3.11: "311"
+     3.10: '310'
+     3.11: '311'

or

- epoch: 1
+ description: "SentencePiece is an unsupervised text tokenizer and detokenizer"
- epoch: 2
+ description: SentencePiece is an unsupervised text tokenizer and detokenizer

I'd like to just run 'yam' and have it remove all those changes.

Dominant language
Go
Stars
34
Forks
20
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

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.

More from chainguard-dev/yam

All issues in chainguard-dev/yam

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.