Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint script #65

Merged
merged 1 commit into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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