-
Notifications
You must be signed in to change notification settings - Fork 10
chore(deps): update pre-commit hook google/yamlfmt to v0.16.0 #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: konflux-poc
Are you sure you want to change the base?
chore(deps): update pre-commit hook google/yamlfmt to v0.16.0 #207
Conversation
Signed-off-by: red-hat-konflux <126015336+red-hat-konflux[bot]@users.noreply.github.com>
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: red-hat-konflux[bot] The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @red-hat-konflux[bot]. Thanks for your PR. I'm waiting for a opendatahub-io member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## konflux-poc #207 +/- ##
==============================================
Coverage ? 14.97%
==============================================
Files ? 111
Lines ? 29629
Branches ? 94
==============================================
Hits ? 4438
Misses ? 24804
Partials ? 387 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This PR contains the following updates:
v0.10.0
->v0.16.0
Note: The
pre-commit
manager in Renovate is not supported by thepre-commit
maintainers 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.16.0
Compare 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
libyaml
which 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.0
Compare 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
gitlab
output formatGenerate yamlfmt results in GitLab Code Quality report format. See more info here.
gitignore
match typeWe had support already for
gitignore_excludes
, i.e. using agitignore
file 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.yamlfmt
Docker imageyamlfmt
is now available as a Docker image! This was originally done for the purpose of usingyamlfmt
in CI, but could be useful in other scenarios too. See download and usage instructions in the README.Contributors
gitlab
output format andgitignore
match 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!v0.14.0
Compare Source
Shoutouts To The Community Release
I have been in not the best health the last while, which is why this release took so long to cut. On the bright side, this release features more contributions from the community than from myself. Thank you to everyone who contributed!
Features
strip_directives
yaml.v3
does not support directives. The best thing to do would be to add some amount of support for directives, which I will do in the future just taking it as far as the parser not failing upon finding a directive. In the short term, I added ahotfix
style feature that will strip the directives before formatting and put them back in. The feature is fraught with edge cases and only works reliably with directives at the top of the file. See the explanations I added in the docs.gitignore_excludes
searches up the directory structure for the nearest.gitignore
Arguably a fix, the
gitignore_excludes
feature will now look up the directory structure for the nearest.gitignore
which unlocks monorepo usage patterns foryamlfmt
.JSON schema
The community has added a JSON Schema! I'm calling it out in release notes, but this is not tied to yamlfmt releases in any way. If you have any fixes or improvements to make, they will not need to be tied to git tags being cut.
I am not super familiar with JSON Schema; I will try my best not to break it and keep it up to date but I'm not gonna be great at addressing potential deeper issues with it.
Validating releases with
cosign
The release artifacts now generate other artifacts that allow you to verify releases using the
cosign
tool.Fixes
The
line_ending
setting in theformatter
config is respected againThis was a regression in v0.13.0 where I did some refactors to config discovery. I uncovered an edge case in my original code to handle the
line_ending
setting in theformatter
block (vs the global version). This has been fixed in this release.eof_newline
no longer panics on an empty fileIf the file was empty, the
eof_newline
feature would panic. Never thought of that! This has been fixed.Contributors
@thiagowfx added the JSON Schema
@Shion1305 fixed the
eof_newline
panic@dhth added cosign support to releases
@nikaro added .gitignore discovery
I think this is the most contributors I've had in a release! Thank you everyone!
Changelog (generated)
strip_directives
by @braydonk in https://github.com/google/yamlfmt/pull/217Full Changelog: google/yamlfmt@v0.13.0...v0.14.0
v0.13.0
Compare Source
The Airplane✈️ Release
This release doesn't have anything to do with airplanes, but I did the last few PRs and cut the release while I was on a plane so that's what came to mind. 😄
Features
Print Config
With the new
-print_conf
flag, you can have yamlfmt print out all configuration values it is using (whether they are default or overridden by a config file). This in combination with-debug config
should make figuring out yamlfmt config problems much simpler going forward!Trim Trailing Whitespace
Using the formatter option
trim_trailing_whitespace
, you can now tell yamlfmt to trim any trailing whitespace from lines. This is helpful in general, but it is specifically useful if you are affected by #86. With trailing whitespace being trimmed, this buggy output shouldn't get tripped. Not a perfect solution, but hopefully should help.EOF Newline
Using the formatter option
eof_newline
, yamlfmt will forcibly add a newline to the end of the file if it's not there already. This is for particular scenarios whenretain_line_breaks
is not turned on, but the newline at the end of files is still required.Contributors
-print_conf
feature and was very receptive to feedback on their PR. They also contributed a fix to CI, and automatic versioning in the yamlfmt binary to avoid future bugs like what happened with v0.12.1. Thank you!v0.12.1
Compare Source
Fix stdin output
I made a mistake in the last release that caused the
stdin
operation to output a byte array instead of a properly casted string. I will add integration tests to save this from happening in the future.Known Issue: I was in a rush to get this out when I saw it and forgot to manually update the version string, so
yamlfmt -version
will printv0.12.0
for this version.v0.12.0 Release notes below.
Output Format Release
I have unfortunately been dealing with a long-running health problem that has made it difficult to do much work on this or any projects for the past couple of months. I did manage to get together some small features and fixes worth noting.
Features
Output Format
You can now choose different output formats for lint/dry run. The first alternate output format added is line, which makes it so instead of the full detailed output, yamlfmt outputs single lines for each file with formatting differences. This should allow for easier integration into tools like reviewdog. I have never used that tool, but if anyone is able to get an integration working, feel free to open a Discussion thread about it and let me know!
More config file name options
Last release, I added configuration file naming options to have the yaml extension, i.e. yamlfmt.yaml and yamlfmt.yml. The way I did that made it so you couldn't have config files with extension also be hidden. That is resolved now, so you can have .yamlfmt.yaml etc.
Bug Fixes
Don't write files if there is no diff
Previously, yamlfmt would always write all files set for formatting even when there would be no change. This meant the edited date of the file was always being updated even though nothing was meant to change. That should not happen anymore.
Fix -global_conf not working as documented
The -global_conf flag was not working as documented in the last release. If there was a local config, -global_conf would end up being ignored and the local config would be used first. This was not the intended functionality and it has been fixed.
Contributors
Thanks @kiliantyler for the catching the global configuration bug and opening a fix for it!
1k stars!
Thank you very much for over 1000 stars on GitHub! I appreciate the support, and I hope the tool continues to be useful to the community!
v0.12.0
Compare Source
Output Format Release
I have unfortunately been dealing with a long-running health problem that has made it difficult to do much work on this or any projects for the past couple of months. I did manage to get together some small features and fixes worth noting.
Features
Output Format
You can now choose different output formats for lint/dry run. The first alternate output format added is
line
, which makes it so instead of the full detailed output, yamlfmt outputs single lines for each file with formatting differences. This should allow for easier integration into tools like reviewdog. I have never used that tool, but if anyone is able to get an integration working, feel free to open a Discussion thread about it and let me know!More config file name options
Last release, I added configuration file naming options to have the yaml extension, i.e.
yamlfmt.yaml
andyamlfmt.yml
. The way I did that made it so you couldn't have config files with extension also be hidden. That is resolved now, so you can have.yamlfmt.yaml
etc.Bug Fixes
Don't write files if there is no diff
Previously, yamlfmt would always write all files set for formatting even when there would be no change. This meant the edited date of the file was always being updated even though nothing was meant to change. That should not happen anymore.
Fix
-global_conf
not working as documentedThe
-global_conf
flag was not working as documented in the last release. If there was a local config,-global_conf
would end up being ignored and the local config would be used first. This was not the intended functionality and it has been fixed.Contributors
Thanks @kiliantyler for the catching the global configuration bug and opening a fix for it!
1k stars!
Thank you very much for over 1000 stars on GitHub! I appreciate the support, and I hope the tool continues to be useful to the community!
v0.11.0
Compare Source
Oops, all features!
https://www.youtube.com/watch?v=cXBX2PumuBk
It's been a while since the last release! Life has kept me very busy, but since there were a number of feature requests in the issue queue that weren't too challenging to implement I knocked a bunch of them off the list! I also came up with one feature for this release myself.
Config Discovery Enhancements
Two major enhancements to config discovery! I am pretty sure they are purely additive and shouldn't break any existing workflows, but don't hesitate to open an issue if there's something I missed.
Config file can be
.yamlfmt
,yamlfmt.yaml
, oryamlfmt.yml
Instead of forcing the
.yamlfmt
hidden file name, the command will also recognizeyamlfmt.yaml
oryamlfmt.yml
as a valid file name. (Note that this only applies to automatic config searching; it has never mattered what the name of a file specified directly in the-conf
flag is.)Config file search goes all the way up the directory tree
Instead of only looking for a yamlfmt config in the working directory, it will look at every directory up from the current directory and use the nearest config file it can find. If it doesn't find one all the way up the tree, then it will default to the config file in the global location at
$XDG_CONFIG_HOME/yamlfmt
(LOCALAPPDATA
on Windows). This should be useful for monorepo scenarios, where you might want to apply a singleyamlfmt
config file to a number of projects within the monorepo, instead of needing a config file in every sub-project or having to manually specify with-conf
.This does change some potential scenarios where previously the global config would have been discovered. To combat this, I added a new command line flag
-global_conf
that will force using the config from the global location.Similarly, I added
-no_global_conf
to force not using the global config.Use a
.gitignore
for excludesThe
-gitignore_excludes
orgitignore_excludes
top-level config option will allowyamlfmt
to use patterns from a.gitignore
file for excluding files from formatting! This should be helpful for scenarios where you previously would have needed to repeat all of these patterns in your ownyamlfmt
excludes config. You can also specify a specific path to a.gitignore
file with-gitignore_path
orgitignore_path
(command/config respectively).Retain only single line breaks
Sometimes you have yaml files where there are lots of line breaks in a row. Sometimes you want to keep those, but sometimes you only want to keep a single one out of a group. The new formatter-level config option
retain_line_breaks_single
will make it so this:Formats to this:
Debug Logging
(This is the one I came up with)
By default
yamlfmt
is deliberately very quiet on output. This did have a negative though, as even in verbose mode it was hard to figure out which config file was used, or why files may have been excluded/included in formatting. Introducing the-debug
command line flag! Currently there are two debug logging profiles:config
profile will log the config file discovery process so you can figure out which config file was used and whypaths
profile will log the include/exclude process to understand exactly which paths are included/excluded and whyRead more about usage in the docs: https://github.com/google/yamlfmt/blob/v0.11.0/docs/command-usage.md#debug-logging
Conclusion
I knocked out a good number of the issues that aren't rooted in the yaml parsing/formatting portion of the tool (only one outlier that I'll address soon). This means my future focus is on how to solve some of the weird yaml problems. Right now it is looking like the main way for me to address these issues is by finally biting the bullet and writing my own. I decided to address a number of features this release to make sure I don't leave open issues out to dry while I dive into this new challenge.
As always, don't hesitate to open an issue if you have any problems!
Configuration
📅 Schedule: Branch creation - "after 5am on thursday" (UTC), 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.
To execute skipped test pipelines write comment
/ok-to-test
.This PR has been generated by MintMaker (powered by Renovate Bot).