#227 provide a way to run client-side linter for our projects
Opened 6 years ago by kparal. Modified 6 years ago

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).


Metadata Update from @kparal:
- Issue assigned to kparal
- Issue priority set to: Normal

6 years ago

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?

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.

Login to comment on this ticket.

Metadata