google / yamlfmt

An extensible command line tool or library to format yaml files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

-lint always fails

nobu-k opened this issue · comments

I've just started using yamlfmt since v0.4.0, so I don't know how it worked before, but I think this issue was introduced in v0.4.0 because of the new diff library.

https://github.com/RageCage64/multilinediff seems to always return non-empty string but

if diffContent != "" {
detects lint errors by checking if a return value is empty or not. As a result, running yamlfmt with -lint always fails even if there's no diff.

Similarly, -dry always outputs all contents.

Thank you for making an issue!

Pretty silly oversight on my part, when I was testing this I only tested it on yaml that needed changes, and forgot the test case of a yaml file that's already formatted. 😧

I can get a patch release out for this tomorrow.

While fixing this I found another thing that I meant to fix on v0.4.0, which is that the multiline diffing always assumed \n. This was a bit of a bigger change than I expected that required an API change, so I'll be doing this in a new minor release.

Thank you for your quick work!

v0.5.0 is released! Thank you for your patience and hopefully this works better.

I confirmed it's been fixed! Thank you!