Skip to content

Saving a specific message-format to a file, while also producing "normal" output #14555

@BatmanAoD

Description

@BatmanAoD

Problem

In CI, it can be useful to generate a code-quality report while also printing a job log designed for humans to read. cargo check provides --message-format json, which enables generating machine-readable output that can be used to generate a report programmatically (e.g. with https://crates.io/crates/gitlab_clippy); but currently, there's no way to do this in such a way that cargo also produces useful human-readable output. cargo clippy --message-format json | tee <file> is too verbose and difficult to read.

Because of this, gitlab_clippy recommends running cargo check twice in CI, once to produce readable output and fail the job if there are errors, and again to produce a report.

Proposed Solution

There could be an additional flag that would take a file argument and permit sending json messages to that file, while emitting the "normal" Cargo output on stdout.

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-console-outputArea: Terminal output, colors, progress bar, etc.A-json-outputArea: JSON message outputC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-team-inputStatus: Needs input from team on whether/how to proceed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions