Django's new URLconfig style allows us to no longer ignore PEP8s error

E128
This commit is contained in:
Raphael Michel
2015-03-13 00:07:14 +01:00
parent 97f5e4a2f1
commit 25fff77be5
3 changed files with 5 additions and 9 deletions

View File

@@ -7,7 +7,7 @@ install:
- pip install -q -r src/requirements.txt - pip install -q -r src/requirements.txt
before_script: before_script:
- cd src - cd src
- flake8 --ignore=E123,E128,F403,F401,N802,C901,W503 . - flake8 --ignore=E123,F403,F401,N802,C901,W503 .
- python manage.py check - python manage.py check
- python manage.py validate - python manage.py validate
script: script:

View File

@@ -8,15 +8,13 @@ Python code
Use `flake8`_ to check for conformance problems. The project includes a setup.cfg Use `flake8`_ to check for conformance problems. The project includes a setup.cfg
with a default configuration for flake8 that excludes migrations and other non-relevant with a default configuration for flake8 that excludes migrations and other non-relevant
code parts. It also silences a few checks, ``N802`` (function names should be lowercase) and code parts. It also silences a few checks, e.g. ``N802`` (function names should be lowercase)
``E128`` (continuation line under-indented for visual indent) as well as increasing the and increases the maximum line length to more than 79 characters. **However** you should
maximum line length to more than 79 characters. **However** you should still name all your still name all your functions lowercase [#f1]_ and keep your lines short when possible.
functions lowercase [#f1]_ and keep your lines short when possible. [#f2]_
* Our build server will reject all code violating other flake8 checks than the following: * Our build server will reject all code violating other flake8 checks than the following:
* E123: closing bracket does not match indentation of opening brackets line * E123: closing bracket does not match indentation of opening brackets line
* E128: continuation line under-indented for visual indent
* F403: ``from module import *`` used; unable to detect undefined names * F403: ``from module import *`` used; unable to detect undefined names
* F401: module imported but unused * F401: module imported but unused
* N802: function names should be lowercase * N802: function names should be lowercase
@@ -55,5 +53,3 @@ LESS stylesheets
.. _Django Coding Style: https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/ .. _Django Coding Style: https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/
.. _mixins: http://lesscss.org/features/#mixins-feature .. _mixins: http://lesscss.org/features/#mixins-feature
.. [#f1] But Python's very own ``unittest`` module forces us to use ``setUp`` as a method name... .. [#f1] But Python's very own ``unittest`` module forces us to use ``setUp`` as a method name...
.. [#f2] The underindentation-thing is silenced because PEP8-conforming indentation looks very bad
in the ``urls.py`` modules.

View File

@@ -76,7 +76,7 @@ class CartDisplayMixin:
# Django is unable to join related models in a .values() query # Django is unable to join related models in a .values() query
def keyfunc(pos): def keyfunc(pos):
if answers and ((pos.item.admission and self.request.event.settings.attendee_names_asked == 'True') if answers and ((pos.item.admission and self.request.event.settings.attendee_names_asked == 'True')
or pos.item.questions.all()): or pos.item.questions.all()):
return pos.id, "", "", "" return pos.id, "", "", ""
return "", pos.item_id, pos.variation_id, pos.price return "", pos.item_id, pos.variation_id, pos.price