New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce basic PEP8 style with a pre-commit git hook #493
Comments
I've since learnt that we can't enforce a git hook within the repository itself (which surprised me as things like |
Currently I've had to ignore losts of PEP8 codes given the current state of the codebase - the goal would be to clean this up (see also the stricter pre-commit hook we've been using as per GitHub issue biopython#493.
Can now use this without errors, see GitHub issues biopython#493 and biopython#840: $ pep8 --select W291 Bio/ BioSQL/ Tests/ Scripts/ Doc/
Comment from @MarkusPiotrowski on the mailing list:
http://lists.open-bio.org/pipermail/biopython-dev/2016-July/021468.html This is very simple to install, although likely to be quite verbose and complain about many things already in Biopython (like our legacy mixed case module names). |
Thinking about this again, I think we should do something like this:
The new script would ideally cover not just the command line tool |
Work in progress here which runs flake8 etc and rst-lint (planned for the TravisCI/Tox setup soon): https://github.com/peterjc/biopython/blob/pre_commit_linting/Scripts/git_pre_commit_hook.py |
I've updated the hook on my branch which runs https://github.com/peterjc/biopython/blob/pre_commit_linting/Scripts/git_pre_commit_hook.py This makes it much simpler to explain to a new-comer what is going on with the TravisCI tests vs the git hook, which is a plus. I still like the idea of the git hook being stricter, but making them the same seems more practical. And over time we'll hopefully cleanup the back-log of style violations anyway. |
Nice, this is quite a step forward from the previous hook! I think whether TravisCI/local check have the same settings or local is stricter doesn't make much of a difference, so the current choice seems fine. |
I've been thinking (now that we run
Personally, I set the configuration globally rather than just on the current repository. See: http://flake8.pycqa.org/en/latest/user/using-hooks.html The downside is this would only check the Python files, and not the |
As per my last comment, I was hoping we might be able to use the default Update: See flake8 feature request https://gitlab.com/pycqa/flake8/issues/347 to support directory/file level ignores in project configuration file |
Can now use this without errors, see GitHub issues biopython#493 and biopython#840: $ pep8 --select W291 Bio/ BioSQL/ Tests/ Scripts/ Doc/
My comment here #2014 (comment) was probably better on the original issue. |
Flake8 pre-commit hook documented as of #2075. |
See PR biopython#2074 and issues biopython#493 / biopython#2014
See discussion on #406 and on the mailing list (e.g. http://mailman.open-bio.org/pipermail/biopython-dev/2014-October/020741.html ) where @cbrueffer proposed adopting this pre-commit git hook: https://github.com/cbrueffer/pep8-git-hook
I've been using this on Mac and Linux and it works very nicely.
Before adopting this we need to test it under Windows, where we need to know if it works, safely has no effect, or causes problems.
The text was updated successfully, but these errors were encountered: