add code beautification task to makefile
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
This commit is contained in:
parent
de8c37ad00
commit
7005fabd4d
|
@ -1,6 +1,7 @@
|
||||||
# Non Code related contents
|
# Non Code related contents
|
||||||
include LICENSE
|
include LICENSE
|
||||||
include README.rst
|
include README.rst
|
||||||
|
include pyproject.toml
|
||||||
|
|
||||||
# Setup
|
# Setup
|
||||||
include setup.py
|
include setup.py
|
||||||
|
|
24
Makefile
24
Makefile
|
@ -12,11 +12,18 @@ help:
|
||||||
@echo " Install Sanic"
|
@echo " Install Sanic"
|
||||||
@echo "docker-test"
|
@echo "docker-test"
|
||||||
@echo " Run Sanic Unit Tests using Docker"
|
@echo " Run Sanic Unit Tests using Docker"
|
||||||
|
@echo "black"
|
||||||
|
@echo " Analyze and fix linting issues using Black"
|
||||||
|
@echo "fix-import"
|
||||||
|
@echo " Analyze and fix import order using isort"
|
||||||
|
@echo "beautify [sort_imports=1] [include_tests=1]"
|
||||||
|
@echo " Analyze and fix linting issue using black and optionally fix import sort using isort"
|
||||||
@echo ""
|
@echo ""
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
find . ! -path "./.eggs/*" -name "*.pyc" -exec rm {} \;
|
find . ! -path "./.eggs/*" -name "*.pyc" -exec rm {} \;
|
||||||
find . ! -path "./.eggs/*" -name "*.pyo" -exec rm {} \;
|
find . ! -path "./.eggs/*" -name "*.pyo" -exec rm {} \;
|
||||||
|
find . ! -path "./.eggs/*" -name ".coverage" -exec rm {} \;
|
||||||
rm -rf build/* > /dev/null 2>&1
|
rm -rf build/* > /dev/null 2>&1
|
||||||
rm -rf dist/* > /dev/null 2>&1
|
rm -rf dist/* > /dev/null 2>&1
|
||||||
|
|
||||||
|
@ -32,3 +39,20 @@ install:
|
||||||
docker-test: clean
|
docker-test: clean
|
||||||
docker build -t sanic/test-image -f docker/Dockerfile .
|
docker build -t sanic/test-image -f docker/Dockerfile .
|
||||||
docker run -t sanic/test-image tox
|
docker run -t sanic/test-image tox
|
||||||
|
|
||||||
|
beautify: black
|
||||||
|
ifdef sort_imports
|
||||||
|
ifdef include_tests
|
||||||
|
$(warning It is suggested that you do not run sort import on tests)
|
||||||
|
isort -rc sanic tests
|
||||||
|
else
|
||||||
|
$(info Sorting Imports)
|
||||||
|
isort -rc sanic
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
black:
|
||||||
|
black --config ./pyproject.toml sanic tests
|
||||||
|
|
||||||
|
fix-import: black
|
||||||
|
isort -rc sanic
|
Loading…
Reference in New Issue
Block a user