Phabricator used to run linters (flake8 and pep8) for us. Now that we don't have it, let's find a good way to have the same functionality again - running the linters on the diff only (against develop, but should be configurable), with a possibility to override, and easily for newcomers (without too difficult configuration or execution, something like make lint).
flake8
pep8
develop
make lint
Metadata Update from @kparal: - Issue assigned to kparal - Issue priority set to: Normal
git diff -U0 develop | flake8 --diff works just fine for me. make lint could do just that (or maybe even take the develop part as a non-required argument?
git diff -U0 develop | flake8 --diff
As discussed on the meeting, pre-commit hook for flake8 (allows to commit, bugs with errors) might also be a way to tackle this, I'm not sure we could go with any forced checks, though - as in server hooks that decline push if lint errors are found.
Although @kparal does not agree, I am of the mind that we should just plain change our codebase to be "our definition of pep8" valid, and go on from that, maybe even using autopep8 with sensible settings.
OK, so there is a bug in the newer versions of flake8, that make it check even the non-python files (and ignore the --filename option on command line and in tox.ini). I submitted a bug report https://gitlab.com/pycqa/flake8/issues/362 so hopefully this will change sometimes in the near future.
In the mean time, we could use git diff -U0 develop -- '*.py' | flake8 --diff to work around that.
git diff -U0 develop -- '*.py' | flake8 --diff
A link for future self: https://github.com/pycqa/flake8/blob/master/docs/source/user/using-hooks.rst
Log in to comment on this ticket.