Skip to content
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 structured output flag #137

Closed
Jake-Shadle opened this issue Feb 13, 2020 · 4 comments · Fixed by #217
Closed

Add structured output flag #137

Jake-Shadle opened this issue Feb 13, 2020 · 4 comments · Fixed by #217
Assignees
Labels
enhancement New feature or request

Comments

@Jake-Shadle
Copy link
Member

Jake-Shadle commented Feb 13, 2020

Right now we just spit out (almost) all the diagnostics to stderr, which is fine for running locally as a user, but when running in CI, it would be good to additionally support structured output, that can then be consumed more easily by other tools etc to eg. add annotations in gihub actions. Presumably the structured output would just be JSON.

See EmbarkStudios/cargo-deny-action#10

@Jake-Shadle Jake-Shadle added the enhancement New feature or request label Feb 13, 2020
@luser
Copy link
Contributor

luser commented Apr 10, 2020

Our security folks are using cargo audit --json for automated reporting, but I switched our main CI to use cargo deny. It'd be nice if we had JSON output so we were using the same tool in both places.

@Jake-Shadle
Copy link
Member Author

Jake-Shadle commented May 4, 2020

I am going to work on this today and see about using it in the action to resolve EmbarkStudios/cargo-deny-action#10. Out of curiosity, do you use the action, or do you run it in a different CI? We use Buildkite for our internal projects so I could add a guide in the docs about how to use the JSON output for reporting in CI, generally.

@Jake-Shadle Jake-Shadle self-assigned this May 4, 2020
@luser
Copy link
Contributor

luser commented May 4, 2020

We're running our CI in CircleCI.

@tarcieri
Copy link

The core reporting functionality in the rustsec constructs a serde-serializable Report struct:

https://docs.rs/rustsec/latest/rustsec/report/struct.Report.html

Jake-Shadle added a commit that referenced this issue Jun 23, 2020
Added `--color` which takes the options `auto`, `always`, or `never` to turn on or off coloring for all output.

Added `--format` which takes the options `human` or `json`. The Json option writes each distinct output as a single Json object.

Resolves: #137
Resolves: #211
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants