Skip to content
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

PEP8 #25

Open
s-celles opened this issue Apr 6, 2017 · 2 comments
Open

PEP8 #25

s-celles opened this issue Apr 6, 2017 · 2 comments

Comments

@s-celles
Copy link

s-celles commented Apr 6, 2017

Code should respect PEP8.
Code linter such as flake8 can help

It can be add on Travis side, so when PR is send PEP8 conformance is checked

install:
  - if [ "$TRAVIS_PYTHON_VERSION" = '3.2_with_system_site_packages' ]; then pip install -q 'coverage<4'; fi
  - pip install -q coveralls flake8
  - python setup.py install

...

script:
  - nosetests -v --with-coverage --cover-package gtabview || {
      ret=$?;
      [ "$TRAVIS_PYTHON_VERSION" = '3.2_with_system_site_packages' -a $ret = 134 ] && exit 0;
      exit $ret;
    }
  - flake8 --version
  - flake8 --ignore E501 .

Here is current status:

$ flake8 --ignore E501 .
./setup.py:8:21: W503 line break before binary operator
./gtabview/__init__.py:10:1: F401 'io' imported but unused
./gtabview/__init__.py:15:1: F403 'from .compat import *' used; unable to detect undefined names
./gtabview/__init__.py:75:31: E712 comparison to False should be 'if cond is False:' or 'if not cond:'
./gtabview/__init__.py:112:21: E701 multiple statements on one line (colon)
./gtabview/__init__.py:176:20: E701 multiple statements on one line (colon)
./gtabview/__init__.py:177:23: E701 multiple statements on one line (colon)
./gtabview/__init__.py:178:22: E701 multiple statements on one line (colon)
./gtabview/__init__.py:188:29: F405 'basestring' may be undefined, or defined from star imports: .compat
./gtabview/compat.py:2:10: E401 multiple imports on one line
./gtabview/compat.py:6:11: F821 undefined name 'unicode'
./gtabview/dataio.py:8:1: F403 'from .compat import *' used; unable to detect undefined names
./gtabview/dataio.py:61:1: E303 too many blank lines (3)
./gtabview/dataio.py:62:31: F405 'basestring' may be undefined, or defined from star imports: .compat
./gtabview/dataio.py:78:31: F405 'basestring' may be undefined, or defined from star imports: .compat
./gtabview/dataio.py:98:45: F405 'basestring' may be undefined, or defined from star imports: .compat
./gtabview/dataio.py:127:10: E128 continuation line under-indented for visual indent
./gtabview/dataio.py:129:25: F405 'basestring' may be undefined, or defined from star imports: .compat
./gtabview/dataio.py:129:58: F405 'io' may be undefined, or defined from star imports: .compat
./gtabview/dataio.py:129:69: F405 'file' may be undefined, or defined from star imports: .compat
./gtabview/dataio.py:130:29: F405 'basestring' may be undefined, or defined from star imports: .compat
./gtabview/dataio.py:136:24: E701 multiple statements on one line (colon)
./gtabview/dataio.py:137:24: E701 multiple statements on one line (colon)
./gtabview/models.py:4:1: F403 'from .compat import *' used; unable to detect undefined names
./gtabview/models.py:4:1: F401 '.compat.*' imported but unused
./gtabview/models.py:8:17: E221 multiple spaces before operator
./gtabview/models.py:14:1: E302 expected 2 blank lines, found 1
./gtabview/models.py:74:1: E303 too many blank lines (3)
./gtabview/models.py:179:67: E226 missing whitespace around arithmetic operator
./gtabview/models.py:180:71: E226 missing whitespace around arithmetic operator
./gtabview/models.py:264:14: E127 continuation line over-indented for visual indent
./gtabview/models.py:269:14: E127 continuation line over-indented for visual indent
./gtabview/models.py:272:14: E127 continuation line over-indented for visual indent
./gtabview/models.py:273:14: E127 continuation line over-indented for visual indent
./gtabview/qtpy.py:4:10: E401 multiple imports on one line
./gtabview/qtpy.py:18:9: F401 'PyQt5' imported but unused
./gtabview/qtpy.py:24:9: F401 'PyQt4' imported but unused
./gtabview/qtpy.py:30:9: F401 'PySide' imported but unused
./gtabview/qtpy.py:45:5: F811 redefinition of unused 'QtWidgets' from line 37
./gtabview/viewer.py:3:1: F403 'from .compat import *' used; unable to detect undefined names
./gtabview/viewer.py:5:1: F401 '.models' imported but unused
./gtabview/viewer.py:16:19: E701 multiple statements on one line (colon)
./gtabview/viewer.py:17:50: E701 multiple statements on one line (colon)
./gtabview/viewer.py:20:1: E302 expected 2 blank lines, found 1
./gtabview/viewer.py:21:20: F405 'sys' may be undefined, or defined from star imports: .compat
./gtabview/viewer.py:85:20: E127 continuation line over-indented for visual indent
./gtabview/viewer.py:120:41: E701 multiple statements on one line (colon)
./gtabview/viewer.py:233:5: E303 too many blank lines (2)
./gtabview/viewer.py:234:31: E701 multiple statements on one line (colon)
./gtabview/viewer.py:246:5: E303 too many blank lines (2)
./gtabview/viewer.py:247:31: E701 multiple statements on one line (colon)
./gtabview/viewer.py:259:5: E303 too many blank lines (2)
./gtabview/viewer.py:289:26: E126 continuation line over-indented for hanging indent
./gtabview/viewer.py:299:25: E126 continuation line over-indented for hanging indent
./gtabview/viewer.py:306:5: E303 too many blank lines (2)
./gtabview/viewer.py:313:5: E303 too many blank lines (2)
./gtabview/viewer.py:317:5: E303 too many blank lines (2)
./gtabview/viewer.py:349:20: E701 multiple statements on one line (colon)
./gtabview/viewer.py:352:5: E303 too many blank lines (2)
./gtabview/viewer.py:371:17: F841 local variable 'olm_row' is assigned to but never used
./sample/pandas-example.py:7:11: E127 continuation line over-indented for visual indent
./tests/__init__.py:4:1: F401 'gtabview' imported but unused
./tests/__init__.py:5:1: F401 'gtabview.view' imported but unused
./tests/__init__.py:35:1: E302 expected 2 blank lines, found 1
./tests/__init__.py:41:1: E302 expected 2 blank lines, found 1
./tests/test_dataio.py:4:1: F403 'from . import *' used; unable to detect undefined names
./tests/test_dataio.py:9:26: F405 'os' may be undefined, or defined from star imports: .
./tests/test_dataio.py:9:39: F405 'TDATA_ROOT' may be undefined, or defined from star imports: .
./tests/test_dataio.py:12:1: E302 expected 2 blank lines, found 1
./tests/test_dataio.py:13:26: F405 'os' may be undefined, or defined from star imports: .
./tests/test_dataio.py:13:39: F405 'TDATA_ROOT' may be undefined, or defined from star imports: .
./tests/test_dataio.py:16:1: E302 expected 2 blank lines, found 1
./tests/test_dataio.py:17:26: F405 'os' may be undefined, or defined from star imports: .
./tests/test_dataio.py:17:39: F405 'TDATA_ROOT' may be undefined, or defined from star imports: .
./tests/test_dataio.py:20:1: E302 expected 2 blank lines, found 1
./tests/test_dataio.py:21:26: F405 'os' may be undefined, or defined from star imports: .
./tests/test_dataio.py:21:39: F405 'TDATA_ROOT' may be undefined, or defined from star imports: .
./tests/test_dataio.py:24:1: E302 expected 2 blank lines, found 1
./tests/test_dataio.py:24:2: F405 'require' may be undefined, or defined from star imports: .
./tests/test_dataio.py:26:26: F405 'os' may be undefined, or defined from star imports: .
./tests/test_dataio.py:26:39: F405 'TDATA_ROOT' may be undefined, or defined from star imports: .
./tests/test_models.py:4:1: F403 'from . import *' used; unable to detect undefined names
./tests/test_models.py:12:1: E302 expected 2 blank lines, found 1
./tests/test_models.py:16:12: F405 'materialize' may be undefined, or defined from star imports: .
./tests/test_models.py:18:1: E302 expected 2 blank lines, found 1
./tests/test_models.py:22:12: F405 'materialize' may be undefined, or defined from star imports: .
./tests/test_models.py:24:1: E302 expected 2 blank lines, found 1
./tests/test_models.py:28:12: F405 'materialize' may be undefined, or defined from star imports: .
./tests/test_models.py:29:12: F405 'materialize_header' may be undefined, or defined from star imports: .
./tests/test_models.py:30:12: F405 'materialize_header' may be undefined, or defined from star imports: .
./tests/test_models.py:32:1: E302 expected 2 blank lines, found 1
./tests/test_models.py:36:12: F405 'materialize' may be undefined, or defined from star imports: .
./tests/test_models.py:37:12: F405 'materialize_header' may be undefined, or defined from star imports: .
./tests/test_models.py:38:12: F405 'materialize_header' may be undefined, or defined from star imports: .
./tests/test_models.py:40:1: E302 expected 2 blank lines, found 1
./tests/test_models.py:44:12: F405 'materialize' may be undefined, or defined from star imports: .
./tests/test_models.py:46:1: E302 expected 2 blank lines, found 1
./tests/test_models.py:50:12: F405 'materialize' may be undefined, or defined from star imports: .
./tests/test_models.py:51:12: F405 'materialize_header' may be undefined, or defined from star imports: .
./tests/test_models.py:52:12: F405 'materialize_header' may be undefined, or defined from star imports: .
./tests/test_models.py:54:1: E302 expected 2 blank lines, found 1
./tests/test_models.py:58:12: F405 'materialize' may be undefined, or defined from star imports: .
./tests/test_models.py:60:1: E302 expected 2 blank lines, found 1
./tests/test_models.py:60:2: F405 'require' may be undefined, or defined from star imports: .
./tests/test_models.py:68:12: F405 'materialize' may be undefined, or defined from star imports: .
./tests/test_models.py:69:12: F405 'materialize_header' may be undefined, or defined from star imports: .
./tests/test_models.py:70:12: F405 'materialize_header' may be undefined, or defined from star imports: .
./tests/test_models.py:72:1: E302 expected 2 blank lines, found 1
./tests/test_models.py:72:2: F405 'require' may be undefined, or defined from star imports: .
./tests/test_models.py:86:12: F405 'materialize' may be undefined, or defined from star imports: .
./tests/test_models.py:87:12: F405 'materialize_header' may be undefined, or defined from star imports: .
./tests/test_models.py:88:12: F405 'materialize_header' may be undefined, or defined from star imports: .
./tests/test_models.py:89:12: F405 'materialize_names' may be undefined, or defined from star imports: .
./tests/test_models.py:90:12: F405 'materialize_names' may be undefined, or defined from star imports: .
./tests/test_models.py:92:1: E302 expected 2 blank lines, found 1
./tests/test_models.py:92:2: F405 'require' may be undefined, or defined from star imports: .
./tests/test_models.py:107:12: F405 'materialize' may be undefined, or defined from star imports: .
./tests/test_models.py:108:12: F405 'materialize_header' may be undefined, or defined from star imports: .
./tests/test_models.py:109:12: F405 'materialize_header' may be undefined, or defined from star imports: .
./tests/test_models.py:110:12: F405 'materialize_names' may be undefined, or defined from star imports: .
./tests/test_models.py:111:12: F405 'materialize_names' may be undefined, or defined from star imports: .
./tests/test_models.py:113:1: E302 expected 2 blank lines, found 1
./tests/test_models.py:113:2: F405 'require' may be undefined, or defined from star imports: .
./tests/test_models.py:119:12: F405 'materialize' may be undefined, or defined from star imports: .
./tests/test_models.py:120:12: F405 'materialize_header' may be undefined, or defined from star imports: .
./tests/test_models.py:121:12: F405 'materialize_header' may be undefined, or defined from star imports: .
./tests/test_models.py:123:1: E302 expected 2 blank lines, found 1
./tests/test_models.py:123:2: F405 'require' may be undefined, or defined from star imports: .
./tests/test_models.py:129:12: F405 'materialize' may be undefined, or defined from star imports: .
./tests/test_models.py:131:1: E302 expected 2 blank lines, found 1
./tests/test_models.py:131:2: F405 'require' may be undefined, or defined from star imports: .
./tests/test_models.py:137:12: F405 'materialize' may be undefined, or defined from star imports: .
./tests/test_models.py:139:1: E302 expected 2 blank lines, found 1
./tests/test_models.py:139:2: F405 'require' may be undefined, or defined from star imports: .
./tests/test_models.py:142:30: F405 'os' may be undefined, or defined from star imports: .
./tests/test_models.py:142:43: F405 'TDATA_ROOT' may be undefined, or defined from star imports: .
./tests/test_models.py:145:12: F405 'materialize' may be undefined, or defined from star imports: .
./tests/test_models.py:146:12: F405 'materialize_header' may be undefined, or defined from star imports: .
./tests/test_view.py:4:1: F403 'from . import *' used; unable to detect undefined names
./tests/test_view.py:5:1: F405 'gtabview' may be undefined, or defined from star imports: .
./tests/test_view.py:5:14: E225 missing whitespace around operator
./tests/test_view.py:6:1: F405 'gtabview' may be undefined, or defined from star imports: .
./tests/test_view.py:6:16: E225 missing whitespace around operator
./tests/test_view.py:10:5: F405 'view' may be undefined, or defined from star imports: .
./tests/test_view.py:12:1: E302 expected 2 blank lines, found 1
./tests/test_view.py:13:5: F405 'view' may be undefined, or defined from star imports: .
./tests/test_view.py:15:1: E302 expected 2 blank lines, found 1
./tests/test_view.py:16:5: F405 'view' may be undefined, or defined from star imports: .
./tests/test_view.py:18:1: E302 expected 2 blank lines, found 1
./tests/test_view.py:19:5: F405 'view' may be undefined, or defined from star imports: .
./tests/test_view.py:21:1: E302 expected 2 blank lines, found 1
./tests/test_view.py:22:5: F405 'view' may be undefined, or defined from star imports: .
./tests/test_view.py:24:1: E302 expected 2 blank lines, found 1
./tests/test_view.py:25:5: F405 'view' may be undefined, or defined from star imports: .
./tests/test_view.py:27:1: E302 expected 2 blank lines, found 1
./tests/test_view.py:28:5: F405 'view' may be undefined, or defined from star imports: .
./tests/test_view.py:30:1: E302 expected 2 blank lines, found 1
./tests/test_view.py:31:5: F405 'view' may be undefined, or defined from star imports: .
./tests/test_view.py:31:10: F405 'os' may be undefined, or defined from star imports: .
./tests/test_view.py:31:23: F405 'SAMPLE_ROOT' may be undefined, or defined from star imports: .
./tests/test_view.py:33:1: E302 expected 2 blank lines, found 1
./tests/test_view.py:34:5: F405 'view' may be undefined, or defined from star imports: .
./tests/test_view.py:34:10: F405 'os' may be undefined, or defined from star imports: .
./tests/test_view.py:34:23: F405 'SAMPLE_ROOT' may be undefined, or defined from star imports: .
./tests/test_view.py:36:1: E302 expected 2 blank lines, found 1
./tests/test_view.py:36:2: F405 'require' may be undefined, or defined from star imports: .
./tests/test_view.py:39:5: F405 'view' may be undefined, or defined from star imports: .
./tests/test_view.py:43:1: E302 expected 2 blank lines, found 1
./tests/test_view.py:43:2: F405 'require' may be undefined, or defined from star imports: .
./tests/test_view.py:46:5: F405 'view' may be undefined, or defined from star imports: .

Kind regards

PS: similar issue TabViewer/tabview#144

@wavexx
Copy link
Member

wavexx commented May 4, 2017

I'm thorn on PEP8. I do follow it generally, but doing it strictly leads to arguably less readable code in my view. I already use pyflakes, but again, as for most linters, I run those occasionally.

from . import * (used with compat.py) breaks the general idea of the module itself.

@s-celles
Copy link
Author

s-celles commented Nov 11, 2017

you can simply put # noqa when required
you can also avoid flake8 to report some kind of errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants