Skip to content

Commit

Permalink
Lint script
Browse files Browse the repository at this point in the history
  • Loading branch information
stevelacey committed Oct 26, 2021
1 parent 49418ec commit 0d695d0
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 68 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: 3.8.8
- run: pip install black
- run: pip install black flake8
- run: black worf --check
- run: flake8 worf
8 changes: 6 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ name = "pypi"
worf = {editable = true, path = "."}

[dev-packages]
autoflake = "*"
autopep8 = "*"
black = "==20.8b1"
build = "*"
coverage = "*"
factory-boy = "*"
flake8 = "*"
Expand All @@ -18,10 +20,12 @@ pytest = "*"
pytest-cov = "*"
pytest-django = "*"
pytest-factoryboy = "*"
pytest-xdist = {extras = ["psutil"], version = "*"}
pytest-watch = "*"
build = "*"
pytest-xdist = {extras = ["psutil"], version = "*"}
twine = "*"

[requires]
python_version = "3.8"

[scripts]
lint = "./script/lint"
111 changes: 59 additions & 52 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions script/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -eou pipefail
cd "$(dirname "$0")/.."

Y=$(tput setaf 3) X=$(tput sgr0)

echo -e "${Y}==>${X} Autoflake"
autoflake --in-place --recursive --remove-all-unused-imports worf

echo -e "${Y}==>${X} Black"
black worf

echo -e "${Y}==>${X} Flake8"
flake8 worf
17 changes: 4 additions & 13 deletions worf/views/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
from worf.views.detail import (
DetailAPI,
DetailUpdateAPI,
)
from worf.views.list import (
ListAPI,
ListCreateAPI,
)
from worf.views.base import (
APIResponse,
AbstractBaseAPI,
)
from worf.views.create import CreateAPI
from worf.views.base import APIResponse, AbstractBaseAPI # noqa
from worf.views.create import CreateAPI # noqa
from worf.views.detail import DetailAPI, DetailUpdateAPI # noqa
from worf.views.list import ListAPI, ListCreateAPI # noqa

0 comments on commit 0d695d0

Please sign in to comment.