Skip to content

Commit

Permalink
Merge pull request #170 from maykinmedia/feature/131-pyflake
Browse files Browse the repository at this point in the history
Fixes #131 - Added flake8 to CI
  • Loading branch information
SilviaAmAm committed Mar 10, 2021
2 parents bce82e2 + 1f81af0 commit 1a661d3
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 15 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,17 @@ jobs:
run: pip install -r requirements/dev.txt
- name: Run black
run: black --check --diff src

flake8:
name: Code style
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: pip install -r requirements/dev.txt
- name: Run flake8
run: flake8 src
7 changes: 7 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ known_django=django
known_first_party=archiefvernietigingscomponent
sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER

; black compatible settings
[flake8]
; absolute maximum - more lenient than black's 88
max-line-length = 119
ignore = E121,E123,E126,E226,E24,E704,W503,W504,E231,F405,E203
exclude = migrations,static,media

[coverage:run]
branch = True
source = src
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ def handle(self, *args, **options):
return

password = User.objects.make_random_password(length=20)
user = User.objects.create_superuser(
username=username, email=email, password=password
)
User.objects.create_superuser(username=username, email=email, password=password)

try:
link = f'{settings.ALLOWED_HOSTS[0]}{reverse("admin:index")}'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
Test the various role landing pages.
"""
from django.test import override_settings
from django.urls import reverse, reverse_lazy

from django_webtest import WebTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_create_review_approve(self):

def test_create_review_change(self):
destruction_list = self._create_destruction_list()
next_assignee = DestructionListAssigneeFactory.create(
DestructionListAssigneeFactory.create(
destruction_list=destruction_list, assignee__role=self.user.role
)
items = destruction_list.items.order_by("id").all()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from unittest.mock import patch

from django.conf import settings
from django.contrib.sites.models import Site
from django.core import mail
from django.test import TestCase, override_settings
from django.urls import reverse
Expand Down
2 changes: 0 additions & 2 deletions src/archiefvernietigingscomponent/report/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import uuid as _uuid

from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import ugettext_lazy as _
Expand Down
5 changes: 2 additions & 3 deletions src/archiefvernietigingscomponent/report/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import uuid
from datetime import date, datetime
from typing import Optional

Expand Down Expand Up @@ -46,7 +45,7 @@ def get_looptijd(zaak: dict) -> int:
def get_vernietigings_categorie_selectielijst(selectielijst_procestype: str) -> str:
try:
process_type = fetch_process_type(selectielijst_procestype)
except ClientError as exc:
except ClientError:
# If the process type couldn't be retrieved, return an empty value
return ""

Expand All @@ -73,7 +72,7 @@ def get_destruction_list_archivaris_comments(destruction_list: DestructionList)
def get_zaaktype(zaaktype_url: str) -> dict:
try:
return fetch_zaaktype(zaaktype_url)
except ClientError as exc:
except ClientError:
# If the zaaktype couldn't be retrieved, return an empty dictionary
return {}

Expand Down
6 changes: 4 additions & 2 deletions src/archiefvernietigingscomponent/theme/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class ThemeConfig(SingletonModel):
logo = models.FileField(
upload_to="theme/",
help_text=_(
"Image will be scaled down to a height of 100 pixels. Typically upload a picture with a height of 200 pixels."
"Image will be scaled down to a height of 100 pixels. "
"Typically upload a picture with a height of 200 pixels."
),
)

Expand Down Expand Up @@ -68,7 +69,8 @@ class ThemeConfig(SingletonModel):
default="017092",
validators=[validate_color],
help_text=_(
"Typically a darker shade or contrasting color of the primary color, used for button hover states, panel headers and outlines."
"Typically a darker shade or contrasting color of the primary color, used for button hover states, "
"panel headers and outlines."
),
)

Expand Down
2 changes: 0 additions & 2 deletions src/archiefvernietigingscomponent/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os

from django.core.wsgi import get_wsgi_application

from archiefvernietigingscomponent.setup import setup_env
Expand Down

0 comments on commit 1a661d3

Please sign in to comment.