Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 755
Abraham Avatar asked Feb 01 '18 16:02

Abraham


3 Answers

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.

like image 85
Mark E. Hamilton Avatar answered Nov 07 '22 01:11

Mark E. Hamilton


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.

like image 27
Matteo Giani Avatar answered Nov 07 '22 01:11

Matteo Giani


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
like image 1
dan Avatar answered Nov 07 '22 00:11

dan