Code review comment for lp:~javier.collado/utah/static_analysis_6

Revision history for this message
Javier Collado (javier.collado) wrote :

@Joe

What I use is flake8 (pyflakes + pep8 together):
http://pypi.python.org/pypi/flake8/.

It isn't packaged in ubuntu so you have to install it with:
pip install flake8

In the branch directory I run a command like this:
find . -name '*.py' | xargs flake8

Lately pep8 (http://pypi.python.org/pypi/pep8) has been updated with additional warning/error codes, so sometimes I also run pep8 since latest changes aren't included in flake8 yet. Anyway, I'm not convinced about the usefulness of some of the new warnings/errors, so I'm not being strict with them.

Another interesting tool is autopep8 (http://pypi.python.org/pypi/autopep8/0.8.1) which applies changes to source files needed to meet pep8. For now, I'm just running some experiments with it.

Anyway, the most important thing is to integrate static analysis with your editor, so that any time something is wrong you get immediate feedback and fix it because otherwise all the highlighting becomes annoying. In my case, I'm using vim and syntastic (http://www.vim.org/scripts/script.php?script_id=2736) configured to use flake8. If you use another editor, is quite likely that some kind of integration is already available for it.

For the future, another tool I'd like to use is pep257 (http://pypi.python.org/pypi/pep257/) to make sure that docstrings have a common format across the whole project. However, it currently returns around 1300 errors, so that's something I won't be attempting any time soon.

« Back to merge proposal