开发者

Pylint only Global evaluation

In pylint I use this command --reports=n to disable the reports, but now I开发者_如何学JAVA don't see the Global evaluation more.

Is possible enable only the Global evaluation?


No you can't, Global Evaluation is part of the reports and with --reports=n you disable all the reports .


This post is quite old but here's the current solution:

To disable EVERYTHING other than the Global evaluation section, you must

--disable=RP0001
--disable=RP0002
--disable=RP0003
--disable=RP0101
--disable=RP0401
--disable=RP0701
--disable=RP0801    

The link shared in another answer now seems to be up to date. http://pylint-messages.wikidot.com/all-codes

Note: this still leaves the portion shown below:

Report
======
XXX statements analyzed.

My solution is to capture the standard out and standard error and eliminate the Report section while capturing the score from the Global evaluation and printing the score elsewhere on my own.

I am writing a wrapper around Pylint and pep8 and some internal Python quality checks (company headers, etc.) where this problem came up.


You can use e.g. --disable=RP0701 to disable the Raw metrics part of the report.

This (outdated) list can help to find the IDs of blocks you would like to suppress:

http://pylint-messages.wikidot.com/all-codes

Note that the report IDs have been renamed from Rxxxx to RPxxxx!


As systempunttoout said, this is currently not possible. But you can ask for this on the python-projects@logilab.org mailing list, and submitting a patch is a very good way of getting that feature soon. :-)


I can nearly just get the Global evaluation. To eliminate everything but Duplication and Global evaluation add;

--disable=RP0401 --disable=RP0001 --disable=RP0002 --disable=RP0003 --disable=RP0101 --disable=RP0101 --disable=RP0701

Being unable to disable the duplication report seems to be a bug; http://www.logilab.org/ticket/63424


You could use AWK:

pylint generators.py | awk '$0 ~ /Your code/ || $0 ~ /Global/ {print}'

I got this printout:

No config file found, using default configuration

Global evaluation
Your code has been rated at 8.12/10 (previous run: 8.12/10, +0.00)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜