github google/yamlfmt v0.21.0

4 days ago

Sorry to folks who were likely waiting on the stuff in this release, it's pretty packed. I got sick in December and took my holiday leave early, and I decided to fully and completely disconnect. Lots of stuff packed into this one now that I'm back. Happy new year!

Features

Force single or double quotes #288

You can now force all quoted strings in a yaml document to be ' or ". See the basic formatter docs for more info.

KYAML Formatter #302

yamlfmt can now support the new KYAML format from the Kubernetes project. The support for this is via a new formatter type called kyaml. I built support for alternate formatters into the architecture of yamlfmt all the way back when I first started the tool, but this is the first time I'm actually publishing a new formatter. I recommend a full read of the formatter documentation to get a sense of how to use this alternate formatter.

Bug Fixes

Gitlab output format #272

I don't use Gitlab and didn't implement the feature so I'm not sure if this has been broken the whole time or if there was a schema change somewhere that bricked it, but Gitlab output format from yamlfmt was missing some required fields. This should work now with the new fields added into the output schema.

/dev/stdin as an argument instead of - did not work #291

You're only allowed to read from stdin once in POSIX, but I inadvertently had a codepath that would read the file for a different purpose before reading it for formatting. This caused yamlfmt not to work under that circumstance. This edge case is handled now.

Filepath collector panic #300

In a scenario where filepath.Walk fails to read something from the filesystem, I wasn't handling the error case properly. This never came up because I never had an error case ever appear locally and the linter that would yell at me about missed error checks didn't pick up that particular pattern that filepath.Walk propogates errors with. There should no longer be panics in error scenarios; new behaviour is that paths that failed to read will be surfaced and all other successful reads will be formatted.

Contributions

Thanks to @slipknois for fixing the Gitlab output format.

Don't miss a new yamlfmt release

NewReleases is sending notifications on new releases.