argoproj / argoproj/argo-workflows
Support standardized output format for `argo lint`
- Dominant language
- Go
- Stars
- 17k
- Forks
- 3.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 138
Description
# Summary
Support output formatting on `argo lint` command. Currently, as long as I'm aware of, lint command does not support any of the output formatting but instead it write the error line by line to the stdout/stderr.
example:
```log
/test/hello-world.yaml: in "hello-world-" (Workflow): strict decoding error: unknown field "spec.templates[0].args", unknown field "spec.templates[0].command", unknown field "spec.templates[0].image"
time="2024-12-27T14:45:33.534Z" level=error msg="yaml file at index 0 is not valid: error converting YAML to JSON: yaml: line 15: did not find expected key"
```
By standardized output formatting I expect to see the output something like this:
```json
{
"status": "success", # enum: success or error
"output": [
{
"path": "/path/to/file1.yaml",
"message": "strict decoding error: unknown field...",
"severity": "error", # enum: info/warning/error
"start_line": 1,
"end_line": 5
},
{
"path": "/path/to/file2.yaml",
"message": "yaml file at index 0 is not valid: error...",
"severity": "error", # enum: info/warning/error
"start_line": 15,
"end_line": 15
}
]
}
```
Some formats that I'm aware of at this moment but there could be some more
- custom json format
- simple yet powerful, can leave some flexibility for the users to write their own post-processing based on the result
- [checkstyle](https://checkstyle.sourceforge.io/)
- drawback: there's no standardized format for them ([issue](https://github.com/checkstyle/checkstyle/issues/5166))
- [annotations object from GitHub api](https://docs.github.com/en/rest/checks/runs?apiVersion=2022-11-28#annotations-object)
- standard format supported by GitHub
- supports detailed information such as severity and start/end lines where lint error occurred
- it would be a good fit if somebody considers to integrate with GitHub actions or other CI tools
## Use Cases
Main use case that I have in my mind at the moment is to use them in the CI pipeline to automate the lint error reporting. It's already possible to determine whether there was error or not by checking it's exit code, but further information should be checked manually by the users. By supporting standardized format users can automate this process by piping the output to other tools/scripts.
---
**Message from the maintainers**:
Love this feature request? Give it a 👍. We prioritise the proposals with the most 👍.
Contributor guide
Research direction
Start at the argo lint command entry point and trace how validation errors are currently written to stdout or stderr. The issue does not name files or tests; done requires an agreed standardized format, support for the selected output mode, and output that can be consumed by CI tools.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100