Not long ago, I wrote a parser for Pymetrics to produce an html formatted document designed to be integrated in Jenkins using its Html plugin. In Jenkins CI we have Python support for unit tests, code coverage and lint reporting, but not for code complexity as far as I know.
Pycabehtml tries to solve this problem by parsing the output of Pymetrics and report the trends on SLOC (source lines of code), Number of Python modules, and McCabe code complexity over builds. On top of that, it showcases all those modules and methods which have McCabe index over 10 in temperature like colors. Methods with index 10 to 20 are highlighted in yellow, 20 to 50 in orange and over 50 in red.
In Python, due to its dynamic nature, no code should be beyond 10. If any method does, then its time for a refactor. The sooner you catch those, the better; or it might be too late.
Pycabehtml is licensed GPLv3 and is hosted in bitbucket at: https://bitbucket.org/jordilin/pycabehtml/overview
Here I leave attached just a couple of portions of the report done on the core Django web application framework.
In Jenkins/Hudson would appear a link to the above report (you need to install the Html plugin). The next screenshot is for the opensource project alerta that can be found at: https://bitbucket.org/jordilin/alerta/wiki/Home


