Notify Mypy output via GitHub Workflow Commands
Project description
mypy-gh-action-report
Notify Mypy output via GitHub Workflow Commands
Installation
pip install mypy-gh-action-report
Usage
mypy . | mypy-gh-action-report
or, to generate JSON output
mypy . | mypy-gh-action-report --json-only
Output
For the following Mypy output:
mypy_gh_action_report/types.py:3: error: "list" expects 1 type argument, but 2 given [type-arg]
mypy_gh_action_report/models.py:13: error: Function is missing a return type annotation [no-untyped-def]
mypy_gh_action_report/parser.py:46: error: Item "None" of "Optional[MypyError]" has no attribute "file_name" [union-attr]
mypy_gh_action_report/parser.py:48: error: Item "None" of "Optional[MypyError]" has no attribute "line_no" [union-attr]
mypy_gh_action_report/main.py:16: error: Argument "mypy_output" to "handle_output" has incompatible type "Optional[str]"; expected "str" [arg-type]
Found 8 errors in 4 files (checked 7 source files)
mypy-gh-action-report
will generate:
::warning title=,file=mypy_gh_action_report/types.py,line=3,endLine=,col=,endColumn=::"list" expects 1 type argument, but 2 given
::warning title=,file=mypy_gh_action_report/models.py,line=13,endLine=,col=,endColumn=::Function is missing a return type annotation
::warning title=,file=mypy_gh_action_report/parser.py,line=46,endLine=,col=,endColumn=::Item "None" of "Optional[MypyError]" has no attribute "file_name"
::warning title=,file=mypy_gh_action_report/parser.py,line=48,endLine=,col=,endColumn=::Item "None" of "Optional[MypyError]" has no attribute "line_no"
::warning title=,file=mypy_gh_action_report/main.py,line=16,endLine=,col=,endColumn=::Argument "mypy_output" to "handle_output" has incompatible type "Optional[str]"; expected "str"
with --json-only
flag:
{
"mypy_gh_action_report/types.py": [
{
"line_no": 3,
"error_code": "type-arg",
"type": "error",
"message": "\"list\" expects 1 type argument, but 2 given"
}
],
"mypy_gh_action_report/models.py": [
{
"line_no": 13,
"error_code": "no-untyped-def",
"type": "error",
"message": "Function is missing a return type annotation"
}
],
"mypy_gh_action_report/parser.py": [
{
"line_no": 46,
"error_code": "union-attr",
"type": "error",
"message": "Item \"None\" of \"Optional[MypyError]\" has no attribute \"file_name\""
},
{
"line_no": 48,
"error_code": "union-attr",
"type": "error",
"message": "Item \"None\" of \"Optional[MypyError]\" has no attribute \"line_no\""
}
],
"mypy_gh_action_report/main.py": [
{
"line_no": 16,
"error_code": "arg-type",
"type": "error",
"message": "Argument \"mypy_output\" to \"handle_output\" has incompatible type \"Optional[str]\"; expected \"str\""
}
]
}
Development
In order to contribute to this project you need to have poetry
installed.
In order to run tests issue:
poetry install
poetry run pytest .
Exit codes
Following Scenarios are covered:
Description | Mypy exit code | mypy-gh-action-report exit code |
---|---|---|
Success | 0 | 0 |
Issues found | 1 | 1 |
Mypy errors | 2 | 2 |
TODO
- Group warnings for the same line
Thanks
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for mypy_gh_action_report-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c4a653070869f1a02a7e809e63e2e276e77211c896d62a88a054e2d87e5e609 |
|
MD5 | f542d5de85a91f3bb5bac9d790c99b87 |
|
BLAKE2b-256 | 02287f30c1d2dfab7937bba5e1211fef38005530dae542040cfcf7dfe437587f |
Close
Hashes for mypy_gh_action_report-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b5a5dfeb8e822e614f03a00bbc91130b72c3e57c1115436eef2b9e34849f98b |
|
MD5 | c801850ba5f0346ce8a2c3861536e38f |
|
BLAKE2b-256 | 73f35775bd89e1067fc8e83dfbba6e9cfe90217f693d3880f5f08b7008e30c1b |