You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
piper/src/python_run/scripts/check.sh

30 lines
588 B
Bash

#!/usr/bin/env bash
# Runs formatters, linters, and type checkers on Python code.
set -eo pipefail
# Directory of *this* script
this_dir="$( cd "$( dirname "$0" )" && pwd )"
base_dir="$(realpath "${this_dir}/..")"
# Path to virtual environment
: "${venv:=${base_dir}/.venv}"
if [ -d "${venv}" ]; then
# Activate virtual environment if available
source "${venv}/bin/activate"
fi
python_files=("${base_dir}/piper")
# Format code
black "${python_files[@]}"
isort "${python_files[@]}"
# Check
flake8 "${python_files[@]}"
pylint "${python_files[@]}"
mypy "${python_files[@]}"