#!/bin/bash

# Exit on first command failed
set -e

DIR="$(cd "$(dirname "$0")" && pwd)"
ROOT_DIR="${DIR}/.."
APP_DIR="${ROOT_DIR}/extract_sales"
TEST_DIR="${ROOT_DIR}/tests"

echo "Running linting for Python files"
flake8 $APP_DIR $TEST_DIR $ROOT_DIR/app.py $ROOT_DIR/dev.py

echo "Running linting for YAML files"
yamllint -s -d relaxed $ROOT_DIR

echo "Running tests"
python -m pytest -v $TEST_DIR \
    --cov extract_sales \
    --cov-report term
