Skip to content

Commit

Permalink
Merge pull request #21 from randombenj/feature/run-python-tox
Browse files Browse the repository at this point in the history
add python linting
  • Loading branch information
randombenj authored Nov 13, 2019
2 parents 1ade830 + 001adc3 commit 88a9285
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 16 deletions.
37 changes: 35 additions & 2 deletions .github/workflows/docker.yml → .github/workflows/docat.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,44 @@
name: docker ci
name: docat ci

on: [push]

jobs:

build:
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: lint with flake8
working-directory: backend
run: |
tox -e flake8
- name: lint with black
working-directory: backend
run: |
tox -e black
- name: lint with isort
working-directory: backend
run: |
tox -e isort
docker:
runs-on: ubuntu-latest

steps:
Expand Down
17 changes: 11 additions & 6 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,15 @@ def tag(project, version, new_tag):
# overwrite the tag
dst.unlink()
dst.symlink_to(src)
return {
"message": f"Tag {new_tag} -> {version} successfully created"
}, HTTPStatus.CREATED
return (
{"message": f"Tag {new_tag} -> {version} successfully created"},
HTTPStatus.CREATED,
)
else:
return {
"message": f"Tag {new_tag} could not be created, because it would overwrite a version!"
}, HTTPStatus.CONFLICT
msg = (
f"Tag {new_tag} could not be created, because it would overwrite a version!"
)
return (
{"message": msg},
HTTPStatus.CONFLICT,
)
18 changes: 10 additions & 8 deletions backend/tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
[tox]
envlist = lint
skip_missing_interpreters = True
skipsdist = True

[testenv:lint]
[testenv:flake8]
deps = flake8
black
isort
commands = flake8 --show-source app.py
black --check app.py
isort --check-only app.py
commands = flake8 --show-source app.py {posargs}

[testenv:black]
deps = black
commands = black --check app.py {posargs}

[testenv:isort]
deps = isort
commands = isort --check-only app.py {posargs}

0 comments on commit 88a9285

Please sign in to comment.