Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to mypy's error code documentation #58

Merged
merged 4 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bundled/tool/lsp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ def _parse_output_using_regex(
message=data.get("message"),
severity=_get_severity(data["code"], data["type"], severity),
code=data["code"],
code_description=lsp.CodeDescription(
href=utils.ERROR_CODE_BASE_URL + data["code"]
),
source=TOOL_DISPLAY,
)
diagnostics.append(diagnostic)
Expand Down
1 change: 1 addition & 0 deletions bundled/tool/lsp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# Save the working directory used when loading this module
SERVER_CWD = os.getcwd()
CWD_LOCK = threading.Lock()
ERROR_CODE_BASE_URL = "https://mypy.readthedocs.io/en/latest/_refs.html#code-"


def as_list(content: Union[Any, List[Any], Tuple[Any]]) -> List[Any]:
Expand Down
9 changes: 9 additions & 0 deletions src/test/python_tests/test_linting.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def _log_handler(params):
"message": 'Name "x" is not defined ',
"severity": 1,
"code": "name-defined",
"codeDescription": {
"href": "https://mypy.readthedocs.io/en/latest/_refs.html#code-name-defined"
},
"source": "Mypy",
}
],
Expand Down Expand Up @@ -117,6 +120,9 @@ def _log_handler(params):
"message": 'Name "x" is not defined ',
"severity": 1,
"code": "name-defined",
"codeDescription": {
"href": "https://mypy.readthedocs.io/en/latest/_refs.html#code-name-defined"
},
"source": "Mypy",
}
],
Expand Down Expand Up @@ -236,6 +242,9 @@ def _log_handler(params):
"message": 'Name "x" is not defined ',
"severity": 2,
"code": "name-defined",
"codeDescription": {
"href": "https://mypy.readthedocs.io/en/latest/_refs.html#code-name-defined"
},
"source": "Mypy",
}
],
Expand Down