stackhut icon indicating copy to clipboard operation
stackhut copied to clipboard

Code doesn't pass flake8

Open collingreen opened this issue 8 years ago • 3 comments

The contrib docs suggest that new code should pass flake8, but the existing code does not.

(venv)➜  stackhut-toolkit git:(branch-name) ✗ flake8 stackhut tests
stackhut:1:1: E902 FileNotFoundError: [Errno 2] No such file or directory: 'stackhut'
tests/__init__.py:3:1: F403 'from test_toolkit import *' used; unable to detect undefined names
tests/__init__.py:4:1: W391 blank line at end of file
tests/test_toolkit.py:25:80: E501 line too long (82 > 79 characters)
tests/test_toolkit.py:31:1: E303 too many blank lines (3)
tests/test_toolkit.py:36:80: E501 line too long (84 > 79 characters)
tests/test_toolkit.py:43:80: E501 line too long (80 > 79 characters)
tests/test_toolkit.py:46:80: E501 line too long (83 > 79 characters)
tests/test_toolkit.py:51:9: E303 too many blank lines (2)
tests/test_toolkit.py:59:5: E303 too many blank lines (2)
tests/test_toolkit.py:100:1: E303 too many blank lines (3)
tests/test_toolkit.py:116:9: F841 local variable 'out' is assigned to but never used
tests/test_toolkit.py:130:1: E302 expected 2 blank lines, found 1
tests/test_toolkit.py:137:80: E501 line too long (82 > 79 characters)
tests/test_toolkit.py:142:9: F841 local variable 'out' is assigned to but never used
tests/test_toolkit.py:142:80: E501 line too long (91 > 79 characters)
tests/test_toolkit.py:156:1: E302 expected 2 blank lines, found 1
tests/test_toolkit.py:175:9: F841 local variable 'out' is assigned to but never used
tests/test_toolkit.py:181:9: F841 local variable 'out' is assigned to but never used
tests/test_toolkit.py:181:80: E501 line too long (85 > 79 characters)
tests/test_toolkit.py:188:53: E231 missing whitespace after ':'
tests/test_toolkit.py:188:80: E501 line too long (80 > 79 characters)
tests/test_toolkit.py:192:80: E501 line too long (91 > 79 characters)
tests/test_toolkit.py:194:30: E231 missing whitespace after ','
tests/test_toolkit.py:198:34: E231 missing whitespace after ','
tests/test_toolkit.py:209:9: F841 local variable 'out' is assigned to but never used
tests/test_toolkit.py:215:22: E231 missing whitespace after ','

collingreen avatar Sep 21 '15 02:09 collingreen

Good catch - flake8 is awesome and we need to update the code to handle this (except E501 - not sure about 80 char limit in a world of widescreens!)

mands avatar Sep 23 '15 21:09 mands

I vote for 80 in a world of global tooling that expects that standard; eg: how github displays code.

Additionally, you're in the server space, which is at least more likely to be done via terminal, which generally benefits from the 80 expectation (although most things do support more these days).

Don't want to start a colum-limit bikeshed debate, but four more cents from me:

  • so far I have always had three panes open for stackhut dev (stackhut runhost, app.py, test code consuming the endpoints), so standard width code is helpful. To be fair, none of that is the stackhut internals, so that may not matter.
  • (OPINION) not having to track lines horizontally as well as vertically has always felt easier to read

collingreen avatar Sep 23 '15 22:09 collingreen

You've convinced me! The global standard is 80 and it's not worth going against that without an incredibly strong reason.

  • I'm similar - have 3 panes open when coding services so that makes sense.
  • agree - there is some research out there regarding an optimal line length when reading, and as I remember it's not large.

mands avatar Sep 29 '15 16:09 mands