Update scripts for better env setup and linting
parent
1d544043f8
commit
f72e0082d8
@ -0,0 +1,28 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
source "$(dirname "$0")/_common.sh"
|
||||
|
||||
if [ "${DRONE}" == "true" ]; then
|
||||
_setup_env
|
||||
pip install -r requirements.txt -r dev-requirements.txt
|
||||
fi
|
||||
|
||||
# Run linting commands and capture their return codes
|
||||
"${VIRTUAL_ENV}/bin/python3" -m isort --check ./speech_collect ./tests ./tasks.py
|
||||
ISORT_EXIT_CODE=$?
|
||||
|
||||
"${VIRTUAL_ENV}/bin/python3" -m black --check ./speech_collect ./tests ./tasks.py
|
||||
BLACK_EXIT_CODE=$?
|
||||
|
||||
"${VIRTUAL_ENV}/bin/python3" -m ruff ./speech_collect ./tests ./tasks.py
|
||||
RUFF_EXIT_CODE=$?
|
||||
|
||||
# Check if any linting command failed
|
||||
if [ $ISORT_EXIT_CODE -ne 0 ] || [ $BLACK_EXIT_CODE -ne 0 ] || [ $RUFF_EXIT_CODE -ne 0 ]; then
|
||||
echo "Some linting checks failed"
|
||||
# Exit with a non-zero status, you can choose which error code to return
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "All linting checks passed"
|
Loading…
Reference in New Issue