diff --git a/Dockerfile b/Dockerfile index 5934804b..39ba0cc5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -61,6 +61,9 @@ COPY ./.markdownlint.yaml ${WORKDIR}/ COPY ./.yamllint ${WORKDIR}/ COPY ./.yamlignore ${WORKDIR}/ +# JSON linting conf +COPY ./.prettierrc.yaml ${WORKDIR}/ + CMD ["make", "lint"] ############################################################################### diff --git a/Makefile b/Makefile index b26bb946..666104b4 100644 --- a/Makefile +++ b/Makefile @@ -60,6 +60,7 @@ env: install: dependencies +## Dependency management dependencies: @echo "################################################################################" @echo "## Dependencies: ###############################################################" @@ -67,6 +68,36 @@ dependencies: ${PACKAGE_TOOL} install -r requirements.txt @echo "################################################################################" +outdated: + ${PACKAGE_TOOL} list --outdated + +update: + ${PACKAGE_TOOL} freeze > requirements.txt + +upgrade: + ${PACKAGE_TOOL} list --outdated | cut -f1 -d' ' | tr " " "\n" | awk '{if(NR>=3)print}' | cut -d' ' -f1 | xargs -n1 pip3 install -U + +clean: + ${PACKAGE_TOOL} freeze > unins ; ${PACKAGE_TOOL} uninstall -y -r unins ; rm unins + rm -f .coverage + rm -fr .pytest_cache + rm -fr htmlcov + rm -fr coverage + rm -fr build + find . -path "*/*.pyc" -delete -print || true + find . -path "*/*.pyo" -delete -print || true + find . -path "*/__pycache__" -type d -print -exec rm -fr {} ';' || true + +## Building process +build: env + rsync -av --prune-empty-dirs \ + --exclude '*_test.py' \ + --exclude '*.pyc' \ + --exclude '.venv' \ + --exclude '__pycache__' \ + src/ build/ + +## Source code linting and formatting lint/json: prettier --check ./src/**/*.json @@ -78,15 +109,6 @@ lint/yaml: lint: lint/markdown lint/yaml lint/json test/styling test/static -test/static: dependencies - ${RUNTIME_TOOL} -m pylint --verbose --recursive yes src/ - ${RUNTIME_TOOL} -m flake8 --verbose src/ - ${RUNTIME_TOOL} -m pyright --verbose src/ - -test/styling: dependencies - ${RUNTIME_TOOL} -m pycodestyle --statistics src/ - ${RUNTIME_TOOL} -m autopep8 --diff --recursive --exit-code --verbose . - format/json: prettier --write ./src/**/*.json @@ -95,14 +117,17 @@ format/sources: format: format/sources format/json -build: env - rsync -av --prune-empty-dirs \ - --exclude '*_test.py' \ - --exclude '*.pyc' \ - --exclude '.venv' \ - --exclude '__pycache__' \ - src/ build/ +## Static code analysis +test/static: dependencies + ${RUNTIME_TOOL} -m pylint --verbose --recursive yes src/ + ${RUNTIME_TOOL} -m flake8 --verbose src/ + ${RUNTIME_TOOL} -m pyright --verbose src/ +test/styling: dependencies + ${RUNTIME_TOOL} -m pycodestyle --statistics src/ + ${RUNTIME_TOOL} -m autopep8 --diff --recursive --exit-code --verbose . + +## Unit tests and coverage test: env dependencies ${RUNTIME_TOOL} -m coverage run -m \ pytest --verbose \ @@ -118,26 +143,7 @@ coverage/html: test ${RUNTIME_TOOL} -m coverage html open htmlcov/index.html -outdated: - ${PACKAGE_TOOL} list --outdated - -update: - ${PACKAGE_TOOL} freeze > requirements.txt - -upgrade: - ${PACKAGE_TOOL} list --outdated | cut -f1 -d' ' | tr " " "\n" | awk '{if(NR>=3)print}' | cut -d' ' -f1 | xargs -n1 pip3 install -U - -clean: - ${PACKAGE_TOOL} freeze > unins ; ${PACKAGE_TOOL} uninstall -y -r unins ; rm unins - rm -f .coverage - rm -fr .pytest_cache - rm -fr htmlcov - rm -fr coverage - rm -fr build - find . -path "*/*.pyc" -delete -print || true - find . -path "*/*.pyo" -delete -print || true - find . -path "*/__pycache__" -type d -print -exec rm -fr {} ';' || true - +## Docker Compose commands compose/build: env ${DOCKER_COMPOSE} --profile lint build ${DOCKER_COMPOSE} --profile testing build