-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add support for generating lint output #142
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: crandles 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 |
Welcome @crandles! |
I really like the direction, I'm very sad that we have to add 14k lnes of code just to be able to print filename:line:col:error. On the other hand, I realize that the current go implementation of the yaml loader doesn't give us line numbers. So at the end of the day I think this goes in the right direction. |
Definitely agree. It's probably worth another attempt at pulling the line numbers out of one of the currently vendor-ed decoders. Perhaps I can at least share my failed attempt, if nothing else. Let me know if that would be valuable. Happy to spend a little effort to get this right. An alternative might be to switch yaml decoders outright, but that seemed more than necessary. |
… it is easier to test alternatives
There is no alternative for |
https://pkg.go.dev/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath looks like the top alternative for easily traversing a yaml.Node |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This adds support for rendering validation errors into a simple "lint error format" (e.g. see errorformat), with the intention of piping the lint output to reviewdog to post PR comments pertaining to any validation errors.
Which issue(s) this PR fixes:
N/A
Special notes for your reviewer:
This does pull in a new import,
goccy/go-yaml
. (I see it used in some other kubernetes projects)I was unable to get the otherwise imported yaml packages to get accurate line numbers and have a way to search via field.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: