I have a pylint GitLab CI job that is producing successfully a a badge and an HTML report under a pylint folder.
The resulting URLs are
https://gitlab.com/GROUP/PROJECT/-/jobs/artifacts/master/raw/pylint/pylint.svg?job=pylint
for the badge and
https://gitlab.com/GROUP/PROJECT/-/jobs/artifacts/master/raw/pylint/index.html?job=pylint
for the HTML report.
The badge is shown correctly, but the link downloads the HTML instead of opening it in a new tab.
This happens in multiple places: the main page of the repo (under the title of the project), the README which is markdown, and the docs which are in RST format.
How can I write the URL to open the HTML in a new tab?
I am using pylint-gitlab to create the HTML report, but the instructions there made use of the public folder which messed up the deployment of my documentation to GitLab pages, so I reverted to the solution shown in this SO post (2019 update).
pylint:
stage: test
script:
- pip install pylint-gitlab pylint-exit anybadge
- mkdir pylint
- pylint --output-format=text pyswgo | tee pylint/pylint.log || pylint-exit $?
- PYLINT_SCORE=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' pylint/pylint.log)
- pylint --exit-zero --output-format=pylint_gitlab.GitlabCodeClimateReporter pyswgo > codeclimate.json
- pylint --exit-zero --output-format=pylint_gitlab.GitlabPagesHtmlReporter pyswgo > pylint/index.html
- anybadge --label=Pylint --file=pylint/pylint.svg --value=$PYLINT_SCORE 2=red 4=orange 8=yellow 10=green
- echo "Pylint score is $PYLINT_SCORE"
artifacts:
expose_as: "Pylint artifacts"
paths:
- pylint
reports:
codequality: codeclimate.json
when: always