You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to have the git pre-commit hook be quite strict, requiring explicit by-passing with --no-verify on a case by case basis, while the TravisCI check should be less onerous but mandatory. Right now something like this in .travis.yml could work:
I have no particular preference over using the command line tool pep8 versus flake8 or anything else - whatever is quickest would be practical if they check the same things.
Medium term I'd like us to work towards removing as many of these PEP8 violations as possible and make the TravisCI checking stricter over time.
All the E402 module level import not at top of file violations under Scripts/ are from Scripts/xbbtools/ which I would like to deprecate and remove (edit: see #848)
We have quite a lot of code breaking E731 by using lambda functions.
However, only two files are failing W291 trailing whitespace, Bio/AlignIO/NexusIO.py (which also falls under #820) and Bio/SeqUtils/__init__.py which is a little trickier.
The tests need more work though, lots of PEP8 white space violations etc.
I like this (obviously) and think we should enable this sooner rather than later, before instances of the already eliminated classes creep back into the repo. We can always shorten the ignore list as we go.
This looks great; 20-25s seems like a worthwhile trade off if we can enforce a common style across the library :).
One small suggestion / thing to check is on the use of setup.cfg or .pep8 for storing the PEP8 preferences (which errors to ignore, etc.). AFAIK, it's not only pep8 reads the setup.cfg or .pep8, but some editors which has a pep8 check can use this file as well. Which means the style check of the editor will be the same as what Biopython has.
What I'm not sure about is whether this works for multiple directories, since the traditional setup is to have a single setup.cfg with a single preference set (while we have multiple preference sets, I see).
The reason I have implemented this with different ignore lists for the different folders is practicality - long term I'd like all the folders to obey the same agreed set of coding styles, but right now some parts of the code is more compliant than others.
At the project level, a setup.cfg file or a tox.ini file is read if present (.pep8 file is also supported, but it is deprecated). If none of these files have a [pep8] section, no project specific configuration is loaded.
Given a bit more work so we can use a single pep8 configuration this would be a very good idea @bow 👍
Activity
peterjc commentedon Jun 6, 2016
For comparison, the pre-commit hook currently uses:
All the
E402 module level import not at top of fileviolations underScripts/are fromScripts/xbbtools/which I would like to deprecate and remove (edit: see #848)peterjc commentedon Jun 9, 2016
e.g. 37d926b 8f9c7e9 e1e3e6d 9f96c4d 8cd7843
peterjc commentedon Jun 9, 2016
Progress: 54212c7 9e4967c a973b78 92b4d0e 9866882 450824d
The main code base now only needs:
We have quite a lot of code breaking E731 by using lambda functions.
However, only two files are failing W291 trailing whitespace,
Bio/AlignIO/NexusIO.py(which also falls under #820) andBio/SeqUtils/__init__.pywhich is a little trickier.The tests need more work though, lots of PEP8 white space violations etc.
peterjc commentedon Jun 13, 2016
Progress on the tests with 0daf209 and fe49ffa - now only need to ignore:
Note many of the tab/white space issues here are from embedded sample data files:
White-list test data with trailing whitespaces
White-list test data with trailing whitespaces
Use isinstance() for comparing types (PEP8 E721).
Fix tab/spaces indendation mixes (PEP8 E101).
Fix whitespace style issues in the MMTF code (PEP8 W293, W391, E313, …
cbrueffer commentedon Jul 7, 2016
I like this (obviously) and think we should enable this sooner rather than later, before instances of the already eliminated classes creep back into the repo. We can always shorten the ignore list as we go.
Use isinstance() for comparing types (PEP8 E721).
Fix tab/spaces indendation mixes (PEP8 E101).
Fix whitespace style issues in the MMTF code (PEP8 W293, W391, E313, …
bow commentedon Jul 21, 2016
Hi @peterjc,
This looks great; 20-25s seems like a worthwhile trade off if we can enforce a common style across the library :).
One small suggestion / thing to check is on the use of
setup.cfgor.pep8for storing the PEP8 preferences (which errors to ignore, etc.). AFAIK, it's not only pep8 reads the setup.cfg or .pep8, but some editors which has apep8check can use this file as well. Which means the style check of the editor will be the same as what Biopython has.What I'm not sure about is whether this works for multiple directories, since the traditional setup is to have a single
setup.cfgwith a single preference set (while we have multiple preference sets, I see).peterjc commentedon Jul 22, 2016
The reason I have implemented this with different ignore lists for the different folders is practicality - long term I'd like all the folders to obey the same agreed set of coding styles, but right now some parts of the code is more compliant than others.
According to http://pep8.readthedocs.io/en/release-1.7.x/intro.html#configuration we could also use
tox.inibut as written this pull request deliberately ignores this naming:Given a bit more work so we can use a single pep8 configuration this would be a very good idea @bow 👍
White-list test data with trailing whitespaces
Use isinstance() for comparing types (PEP8 E721).
Fix tab/spaces indendation mixes (PEP8 E101).
Fix whitespace style issues in the MMTF code (PEP8 W293, W391, E313, …