chore(deps): update pre-commit hook google/yamlfmt to v0.20.0 #140
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.
This PR contains the following updates:
v0.14.0->v0.20.0Note: The
pre-commitmanager in Renovate is not supported by thepre-commitmaintainers or community. Please do not report any problems there, instead create a Discussion in the Renovate repository if you have any questions.Release Notes
google/yamlfmt (google/yamlfmt)
v0.20.0Compare Source
v0.19.0Compare Source
With v0.19.0, I have fully reverted all the pre-commit changes done in the v0.18.0 line. I apologize for any drama this caused in your CI. I have learned my lesson and won't modify the pre-commit hook any further. Maybe something will change in the future if someone joins the team maintaining the hook (see https://redirect.github.com/google/yamlfmt/discussions/278) but I personally will not do it.
I have updated the pre-commit docs to include some configuration tricks for how to get around the problems this original form of the hook can cause. Hopefully this should be enough to resolve problems that some users originally experienced that inspired my attempt in the v0.18.0 series.
v0.18.1Compare Source
The previous fix for pre-commit was poorly done. The default experience for a pre-commit hook is to pass all the discovered filenames to the entry, and when yamlfmt receives references to exact files in its list of arguments, by design it will run them through the formatter without checking whether the config would want to run them. With the fix in v0.18.0, this would cause all files in a repo, including non-yaml ones, to run through the formatter unconditionally. I think I have finally settled on a proper implementation, which is explained in the docs.
On a related note, if you are knowledgeable about pre-commit and interested in the future of this project as a pre-commit hook, please take a look at my recent announcement: #278
v0.18.0Compare Source
The primary reason for this release is a change to the pre-commit hook that might be breaking to some users.
Features
pre-commit hook no longer specifies filetypes
The expectation for
yamlfmtis to be run in a working directory of many different filetypes, and to configure what you as a user want the tool to run on based on configuration (file extensions, doublestar patterns, etc). The hook no longer specifiestypes: [yaml]like it used to. You can restore this behaviour by overriding it in your pre-commit config like so:However, you will likely have a better experience by reconfiguring
yamlfmtto match the intended experience.Default usage message on misuse of command
If you use the command
yamlfmtwith no arguments, and no config is discovered, the tool will now output a default usage message to indicate to the user how to properly use the command.v0.17.2Compare Source
Bug Fixes
Alias nodes no longer come with an extra whitespace
In an attempt to fix a behaviour in
yaml.v3's default encoding behaviour that would produce invalid YAML what an alias was used as a key (see #242) I introduced a regression where my fix was too wide of a net and produced an additional whitespace in scenarios where it wasn't necessary (see #250). To the extent of my testing this appears to be fixed now, however if that is not the case please feel free to re-open #250 with the example case that isn't covered or open a new issue.Contributors
Thank you @octo for the bug fix in #260!
v0.17.1Compare Source
Made this patch release because I don't have any upcoming work planned on
yamlfmtat the moment and wanted to get this bugfix released.Bug Fixes
yaml files with just comments had their contents erased.
If a yaml file had just comments, previously yamlfmt would erase the contents. This was an oversight on how
yaml.v3parses a file like this. Comment parsing works such that any comments found are attached as head, line, or foot comments to a given node. Since a yaml file with just comments has no nodes, the comment wouldn't be anywhere in the parse tree because the parse tree would be empty. Empty parse tree = yamlfmt produces an empty document. This is now properly treated as an edge case and will retain the contents as originally passed in if the file is just comments.v0.17.0Compare Source
Features
Better Path Output
Using the
-voption, formatting will print all formatted paths to stdout. With the new debug code-debug diffsformatting will print all the formatted diffs (same as-dryexcept the formatting will actually occur).Force Array Style
With the formatter option
force_array_styleyou can forceflow([x]) orblock(- x) style arrays. With either option chosen, all arrays in the document will be the configured style.Bug Fixes
Using alias node as a key
When using an alias node (
*alias) as a key,yaml.v3broke the YAML spec and output an invalid document. See this comment on the original issue for an explanation.The default behaviour now fixes this, but in case it causes any unexpected side effects there is a formatter option added called
disable_alias_key_correction.v0.16.0Compare Source
Fixing yaml library stuff
This release features fixes for a couple problems in the yaml library, and one new feature.
Features
Alternate Array Indentation
There is now support for
array_indent, indenting arrays at a different level than anything else, andindent_root_array, an option to indent an array that is at the root of the document.To tell you the truth, I couldn't have possibly imagined anyone wanting this. It's quite outlandish to me. I decided to implement it because the request was well specified (#237), it was very simple to implement, and it could be implemented in a completely unintrusive and opt-in way, without me needing to worry whether other parsing might break as a result. Given that, I figured adding new options couldn't hurt!
Bug Fixes
Nested Indentless Arrays
There was an edge case where nested arrays would get collapsed when doing indentless arrays. This has been fixed now and should function as expected.
Comment Rendering Above Document Start
Comments above a document start used to end up rendered below the document start token with an extra newline. After digging into it I found out that this was a deliberate choice made by the upstream library (i.e. it was not in
libyamlwhich that library was ported from) and I consider it an odd choice. I've changed it to work how one would expect, with comments above document start being rendered above the---token.I decided to make the change directly without guarding it with an option, since I thought the default behaviour was so odd and I can't imagine a world where someone wants it that way. But yaml is stupid, you never know if there's a random edge case I couldn't fathom that was broken by this. Hoping it will be okay, but might need a patch release if there's something I missed.
Contributors
v0.15.0Compare Source
Happy 2025!
New year new yamlfmt release! This one once again only features things contributed by the community. I am working on a major feature that I was hoping to finish before pushing this release out, but I ran into a snag and I didn't want to delay these things getting released.
Breaking Changes
New Minimum Go Version is 1.21
Originally I was keeping this library compatible with Go 1.18, which was the latest at the time. There was a time when I tried to update the minimum version to Go 1.20 when it was released, and I ended up getting complaints so I kept it where it was. Go 1.18 is long EOL, and it makes more sense as an application to stay up to date to in-support releases. So the new rule of thumb will be to maintain compatibility with the oldest non-EOL version of Go going forward.
Features
gitlaboutput formatGenerate yamlfmt results in GitLab Code Quality report format. See more info here.
gitignorematch typeWe had support already for
gitignore_excludes, i.e. using agitignorefile to match which files to exclude, similar to how it works with Git. However, it can be useful for positive matches, i.e. what files to actually include, since the gitignore patterns can also be negated meaning that all includes and excludes can be managed by a single gitignore-style file. See more info here.yamlfmtDocker imageyamlfmtis now available as a Docker image! This was originally done for the purpose of usingyamlfmtin CI, but could be useful in other scenarios too. See download and usage instructions in the README.Contributors
gitlaboutput format andgitignorematch type, as well as improvements to the integration test workflowI'm hoping my big new feature will be ready for the next update. Thanks for using
yamlfmt, and thanks to all the contributors!Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.