Skip to content

Add a new output format option to print errors as GitHub Actions Workflow commands  #17612

Open

Description

@edgarrmondragon

Feature

Add a new --output=github option to format errors as Workflow commands, similar to --output=json added in #11396.

Pitch

For example, for this output in JSON format

$ mypy src --output=json
{"file": "src/mylib/client.py", "line": 759, "column": 20, "message": "Argument 1 to \"export_responses\" of \"Client\" has incompatible type \"str\"; expected \"int\"", "hint": null, "code": "arg-type", "severity": "error"}

we'd get the following output in workflow command format

$ mypy src --output=json
::error file=src/mylib/client.py,line=759,col=20::(`arg-type`) Argument 1 to "export_responses" of "Client" has incompatible type "str"

Related:

Activity

  1. wyardley commented on Sep 13, 2024

    @wyardley

    This would be super handy

  2. webknjaz commented on Sep 13, 2024

    @webknjaz
    Member

    @edgarrmondragon do you mean using the annotations feature?

  3. wyardley commented on Sep 13, 2024

    @wyardley

    I'm not the person who opened the issue, but yes, I think this would support allowing annotations, similar to
    ruff check --output-format github or using pylint with the pylint-actions plugin.

  4. edgarrmondragon commented on Sep 13, 2024

    @edgarrmondragon
    ContributorAuthor

    @edgarrmondragon do you mean using the annotations feature?

    Yeah, these: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions

    I'm not the person who opened the issue, but yes, I think this would support allowing annotations, similar to
    ruff check --output-format github or using pylint with the pylint-actions plugin.

    Exactly!

  5. edgarrmondragon commented on Sep 27, 2024

    @edgarrmondragon
    ContributorAuthor

    A PR is up if anyone's interested: #17771

  6. mschoettle commented on Oct 23, 2024

    @mschoettle

    Based on this comment here (#11396 (comment)) I am not sure what the likelihood of this getting accepted will be.

    (Until this comment I was hoping to have a code quality/gitlab output in mypy directly instead of relying on an extra plugin)

  7. blyedev commented on Jan 12, 2025

    @blyedev

    What's the status of this feature? I'd love to use it in my CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions