How to generate an html report using pylint 1.8.2 to publish in gitlab-ci pages?
Asked Answered
D

3

7

I have a django project in gitlab. In one of my CI pipelines, I use pylint to generate a badge with the given score. Also, pylint generate an issues report in txt format. Is there a way to generate this report in html to be publish as an artifact?

Digamy answered 1/2, 2018 at 16:37 Comment(0)
M
11

Unfortunately, as of pylint-1.7 the html output feature has been removed.

https://docs.pylint.org/en/1.8/whatsnew/1.7.html#removed-changes

IMO this is bad, because it prevents users from upgrading to 1.8 unless they want to write their own html page generation code. I'd like to see that feature restored, or made available in some other form (something that translates the json into html similarly to what was previously generated.)

Unless that happens we're stuck with the older version for the forseable future.

Makings answered 26/4, 2018 at 17:45 Comment(0)
N
2

there is pylint-json2html (github: Exirel/pylint-json2html, pypi: pylint-json2html)

example usage:

$ pylint my_package | pylint-json2html -o pylint.html

Provided that you configure your Pylint config file with:

[REPORTS]
output-format=json
Natascha answered 3/11, 2020 at 1:32 Comment(0)
M
1

According to https://docs.pylint.org/en/1.6.0/output.html, you simply want to issue

pylint --output-format=html

but, upon running said command I run into https://github.com/PyCQA/pylint/issues/1388 - hopefully an update will solve it.

Munos answered 2/3, 2018 at 13:21 Comment(1)
A pretty recent version doesn't offer that option: --output-format <format>, -f <format> Set the output format. Available formats are: text, parseable, colorized, json2 (improved json format), json (old json format) and msvs (visual studio). You can also give a reporter class, e.g. mypackage.mymodule.MyReporterClass.Tranche

© 2022 - 2024 — McMap. All rights reserved.