SHELL := bash

compose_local = docker-compose -f local.yml
run_django = ${compose_local} run --rm django
manage_py = ${run_django} ./manage.py


build:
	${compose_local} build

check-migrations:
	${manage_py} makemigrations --dry-run --check

check:
	${manage_py} check

migrate:
	${manage_py} migrate ${args}

makemigrations:
	${manage_py} makemigrations ${args}

createsuperuser:
	${manage_py} createsuperuser

shell:
	${manage_py} shell

shell_plus:
	${manage_py} shell_plus

start-dev:
	${compose_local} up django elastic nginx

test:
	${run_django} pytest ${args}

rebuild_index:
	${manage_py} search_index --rebuild

type-checks:
	${run_django} mypy mentor

bandit:
	bandit -c bandit.yml -r config mentor

check-imports:
	isort --check-only --diff config mentor

sort-imports:
	isort config mentor

flake:
	flake8 config mentor

black:
	black config mentor

lint: black sort-imports flake bandit check check-migrations


