#!/bin/bash

set -o errexit
set -o pipefail
set -o nounset


# isort check
echo "isort..."
isort --check-only --diff lms config

# flake8
echo "flake8..."
flake8 lms

# bandit
echo "bandit..."
bandit -c bandit.yml -r lms config

# django check
echo "check django..."
python3 manage.py check

# check migrations
echo "check migrations..."
python3 manage.py makemigrations --dry-run --check

# compile messages
echo "compile messages..."
python3 manage.py compilemessages -l ru

# check swagger
echo "check swagger..."
./check-swagger.sh api
./check-swagger.sh labapi
./check-swagger.sh externalapi

# run tests
echo "run tests..."
pytest lms --cov
