Skip to content

Commit

Permalink
Merge pull request City-of-Helsinki#48 from suutari-ai/more-flake8
Browse files Browse the repository at this point in the history
Tune style configuration and add more style checks
  • Loading branch information
suutari-ai authored Feb 12, 2018
2 parents 0430a8c + d8af32d commit ef70ec8
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 25 deletions.
3 changes: 2 additions & 1 deletion parkings/api/public/parking_area.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from rest_framework import viewsets
from rest_framework_gis.pagination import GeoJsonPagination
from rest_framework_gis.serializers import GeoFeatureModelSerializer, GeometrySerializerMethodField
from rest_framework_gis.serializers import (
GeoFeatureModelSerializer, GeometrySerializerMethodField)

from parkings.models import ParkingArea

Expand Down
4 changes: 3 additions & 1 deletion parkings/tests/api/enforcement/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

from parkings.models import Operator

from ..utils import ALL_METHODS, check_list_endpoint_base_fields, check_method_status_codes, get
from ..utils import (
ALL_METHODS, check_list_endpoint_base_fields, check_method_status_codes,
get)

list_url = reverse('enforcement:v1:operator-list')

Expand Down
8 changes: 4 additions & 4 deletions parkings/tests/api/enforcement/test_valid_parking.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import pytest
from django.core.urlresolvers import reverse
from django.utils.timezone import utc
from rest_framework.status import HTTP_400_BAD_REQUEST, HTTP_401_UNAUTHORIZED, HTTP_403_FORBIDDEN
from rest_framework.status import (
HTTP_400_BAD_REQUEST, HTTP_401_UNAUTHORIZED, HTTP_403_FORBIDDEN)

from ..utils import (
ALL_METHODS, check_list_endpoint_base_fields, check_method_status_codes, check_response_objects, get,
get_ids_from_results
)
ALL_METHODS, check_list_endpoint_base_fields, check_method_status_codes,
check_response_objects, get, get_ids_from_results)

list_url = reverse('enforcement:v1:valid_parking-list')

Expand Down
4 changes: 3 additions & 1 deletion parkings/tests/api/operator/test_parking.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

from parkings.models import Parking

from ..utils import ALL_METHODS, check_method_status_codes, check_required_fields, delete, patch, post, put
from ..utils import (
ALL_METHODS, check_method_status_codes, check_required_fields, delete,
patch, post, put)

list_url = reverse('operator:v1:parking-list')

Expand Down
4 changes: 3 additions & 1 deletion parkings/tests/api/public/test_parking_area_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

from parkings.models import Parking

from ..utils import check_list_endpoint_base_fields, check_method_status_codes, get, get_ids_from_results
from ..utils import (
check_list_endpoint_base_fields, check_method_status_codes, get,
get_ids_from_results)

list_url = reverse('public:v1:parkingareastatistics-list')

Expand Down
5 changes: 2 additions & 3 deletions parkings/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
from pytest_factoryboy import register

from parkings.factories import (
AdminUserFactory, HistoryParkingFactory, OperatorFactory, ParkingAreaFactory, ParkingFactory, StaffUserFactory,
UserFactory
)
AdminUserFactory, HistoryParkingFactory, OperatorFactory,
ParkingAreaFactory, ParkingFactory, StaffUserFactory, UserFactory)

register(OperatorFactory)
register(ParkingFactory, 'parking')
Expand Down
1 change: 0 additions & 1 deletion parkkihubi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

# Create var root if it doesn't exist
if not os.path.isdir(VAR_ROOT):
print('Creating var root %s' % VAR_ROOT)
os.makedirs(VAR_ROOT)

MEDIA_ROOT = os.path.join(VAR_ROOT, 'media')
Expand Down
3 changes: 3 additions & 0 deletions requirements-style.in
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
flake8
flake8-isort
flake8-print
pep8-naming
9 changes: 8 additions & 1 deletion requirements-style.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
# prequ update
#
flake8==3.5.0
flake8-isort==2.3
flake8-polyfill==1.0.2 # via flake8-isort, pep8-naming
flake8-print==3.0.1
isort==4.2.15 # via flake8-isort
mccabe==0.6.1 # via flake8
pycodestyle==2.3.1 # via flake8
pep8-naming==0.5.0
pycodestyle==2.3.1 # via flake8, flake8-print
pyflakes==1.6.0 # via flake8
six==1.11.0 # via flake8-print
testfixtures==5.4.0 # via flake8-isort
14 changes: 4 additions & 10 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,12 @@ norecursedirs = bower_components node_modules .git .idea
doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL ALLOW_UNICODE

[isort]
atomic=true
combine_as_imports=false
indent=4
known_standard_library=token,tokenize,enum,importlib
known_third_party=django,six
length_sort=false
line_length=120
multi_line_output=5
default_section=THIRDPARTY
known_first_party=parkkihubi,parkings
line_length=79
multi_line_output=4
not_skip=__init__.py
order_by_type=false
skip=migrations,.tox
wrap_length=120

[pydocstyle]
ignore=D100,D104,D105,D200,D203,D400
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ commands = py.test -ra -vvv --strict --cov {posargs}
[testenv:requirements]
basepython = python3.4
deps = prequ==1.3.1
commands = prequ check -v
commands = prequ {posargs:check -v}

[testenv:style]
basepython = python3.4
deps = -rrequirements-style.txt
commands = flake8 {posargs}
commands = flake8 {posargs:--enable=T}

0 comments on commit ef70ec8

Please sign in to comment.