Output of GitlabCodeClimateReporter on Windows not compatible with GitLab
If you run pylint with --output-format=pylint_gitlab.GitlabCodeClimateReporter:codeclimate.json on Windows, the paths in the resulting JSON files contain backslashes. This breaks the hyperlinks that GitLab generates from them.
For example, when the output file contains this:
{
"type": "issue",
"check_name": "C0116",
"description": "C0116: Missing function or method docstring",
"categories": [
"Style"
],
"severity": "minor",
"location": {
"path": "src\\my_package\\main.py",
"lines": {
"begin": 535
}
},
"fingerprint": "d7547a5ea6ffd6d3021e5b4ca3e24b3d5d919ac60cd27413cc594603372311f0"
}
Then the link generated in the GitLab merge request should become:
https://gitlab.com/%{project_path}/-/blob/%{commit_sha}/src/my_package/main.py#L535
but instead becomes:
https://gitlab.com/%{project_path}/-/blob/%{commit_sha}/src%5Cmy_package%5Cmain.py#L535
which GitLab doesn't resolve. Instead, it redirects you to
https://gitlab.com/%{project_path}/-/tree/%{commit_sha}#L535
and displays following error at the top of the resulting page:
"src\my_package\main.py" did not exist on "%{commit_sha}"
Edited by oiskipoiski