Skip to content

Document mypy's exit code #14615

@jp-larose

Description

@jp-larose

Feature

(This is related to #6003)

Could there be an exit code convention akin to what pylint does?
https://pylint.readthedocs.io/en/latest/user_guide/usage/run.html#exit-codes

Pitch

What I like about this is that it distinguishes two different variations of pylint execution errors along with different categories of linting errors, and they can be combined by bitwise addition.

I found a project that elegantly uses these pylint exit codes to allow my CI script to pass even if there are linting issues in the code, but fail if pylint doesn't run correctly.
https://pypi.org/project/pylint-exit/
I'm not suggesting the mypy team create such a tool (but also not discouraging it), but just showing a proof of concept for how exit codes can be used more broadly.

This allows for easier control over what constitutes a failing CI job. In my case, I want the job to pass if mypy does its job and identifies static typing errors, but fail if mypy fails to run properly. If there are type-checking errors, I can look at the report later.

However, I could see a use for saying: fail if these types of type-checking errors are found, but report and pass otherwise, and fail if mypy just doesn't work (e.g. due to bad config).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions