Creating the messages by Category table simply with PyLint

149 Views Asked by At

By Running the pylint --load-plugins pylint_django ~/src/github.com/<repo>/ ||, it creates this very useful table displaying all the messages types, as well as how many of each my codebase has. As well as a WHOLE LOT of other information.

pylint messages table

My question is, how can I get pylint to only output this table, as well as populate the previous and difference columns? I'd love to have a set of commands that runs this table against the tip of Master (previous), and my current branch.

Something like

### pseudocode
pylint table <git hash of previous> <git hash of current> 
1

There are 1 best solutions below

0
Pierre.Sassoulas On

If you launch pylint twice in the same environment with the report option activated (and have permission to write file in this environment) then simply launching pylint -r y --load-plugins pylint_django ~/src/github.com/<repo>/ at commit that interest you should work.

First run:

Raw metrics
-----------

+----------+-------+------+---------+-----------+
|type      |number |%     |previous |difference |
+==========+=======+======+=========+===========+
|code      |14276  |53.52 |NC       |NC         |
+----------+-------+------+---------+-----------+
|docstring |6904   |25.88 |NC       |NC         |
+----------+-------+------+---------+-----------+
|comment   |1887   |7.07  |NC       |NC         |
+----------+-------+------+---------+-----------+
|empty     |3606   |13.52 |NC       |NC         |
+----------+-------+------+---------+-----------+

Second run after adding an issue voluntarily:

Raw metrics
-----------

+----------+-------+------+---------+-----------+
|type      |number |%     |previous |difference |
+==========+=======+======+=========+===========+
|code      |14277  |53.52 |14276    |+1.00      |
+----------+-------+------+---------+-----------+
|docstring |6904   |25.88 |6904     |=          |
+----------+-------+------+---------+-----------+
|comment   |1887   |7.07  |1887     |=          |
+----------+-------+------+---------+-----------+
|empty     |3606   |13.52 |3606     |=          |
+----------+-------+------+---------+-----------+

Ie you can do:

git checkout hash1
pylint -r y ...
git checkout hash2
pylint -r y ...