Skip to content

support CI-friendly formatted output #14962

@leifwalsh

Description

@leifwalsh

Feature

Several CI systems will do nice things with error output if they are formatted in a particular way. For example, ruff supports --format=github to format messages in a way such that the GitHub UI will display the errors in context inside the diff: https://beta.ruff.rs/docs/editor-integrations/#github-actions.

Other systems like GitLab and Azure DevOps also support specific output formats (which are different). ruff's implementation contains some links to the various formats that could be useful: https://github.com/charliermarsh/ruff/blob/31fff4b10ee6d17d9236cefac46fcf725001b2b9/crates/ruff_cli/src/printer.rs#L200

Could mypy also support output formats that integrate into common CI systems as well?

Pitch

This would make PRs easier to review when there are type errors, because rather than needing to read the CI job logs, you could just go into the diff view and see the errors directly in context within the files.

I would be happy to work on this if someone could point me to where in the mypy code the errors get formatted. I've got no experience with the mypy codebase though, so I'm not quite ready to dive in and propose a PR on my own.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions