On my talk at the Plone Conference 2015 (slides, talk notes from Maurits) one of my points was that a written style guide is worth nothing if you can not check/enforce it.
Who cares what a style guide says regarding indentation, dependencies, string quoting, docstrings, handling i18n, etc etc if then one can freely commit changes that go against the said style guide?
Fortunately in Python we already have pep8 (the tool) and flake8 (with its great plugin ecosystem). To top it off, on Plone we already have plone.recipie.codeanalysis. We have the tools.
Talk is cheap
I’ve been putting as much effort and free time as I could to make that happen.
plone.recipe.codeanalysis has been improved ((and by no means only by me)), flake8 plugins have been written, and finally during this last Alpine City Strategic Sprint 2016 I could implement the missing piece: report back to the users (see an example)!
The script is fairly simple:
#!/usr/bin/env bash wget https://raw.githubusercontent.com/plone/buildout.coredev/5.0/bootstrap.py -O bootstrap.py wget https://raw.githubusercontent.com/plone/buildout.coredev/5.0/experimental/qa.cfg -O qa.cfg wget https://raw.githubusercontent.com/plone/plone.recipe.codeanalysis/master/.isort.cfg -O .isort.cfg python bootstrap.py -c qa.cfg bin/buildout -c qa.cfg bin/code-analysis
Run the above on any Plone distribution and see the output collected on parts/code-analysis/flake8.log
Currently only a few packages are checked, but cleanup tasks can start on any Plone package as of now. Be sure to ask for a job that will check that the package remains clean as soon as your cleanup changes are merged!