|
|
|
@ -52,6 +52,34 @@ function sync_test {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# run same tests and checks as with github action but locally
|
|
|
|
|
# takes filename to validate as optional argument
|
|
|
|
|
function validate {
|
|
|
|
|
|
|
|
|
|
if [[ $1 ]]; then
|
|
|
|
|
check_path="$1"
|
|
|
|
|
else
|
|
|
|
|
check_path="."
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "run validate on $check_path"
|
|
|
|
|
|
|
|
|
|
echo "running bandit"
|
|
|
|
|
bandit --recursive --skip B105,B108,B404,B603,B607 "$check_path"
|
|
|
|
|
echo "running black"
|
|
|
|
|
black --diff --color --check -l 79 "$check_path"
|
|
|
|
|
echo "running codespell"
|
|
|
|
|
codespell --skip="./.git" "$check_path"
|
|
|
|
|
echo "running flake8"
|
|
|
|
|
flake8 "$check_path" --count --max-complexity=12 --max-line-length=79 \
|
|
|
|
|
--show-source --statistics
|
|
|
|
|
echo "running isort"
|
|
|
|
|
isort --check-only --diff --profile black -l 79 "$check_path"
|
|
|
|
|
printf " \n> all validations passed\n"
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sync_docker {
|
|
|
|
|
|
|
|
|
|
# check things
|
|
|
|
@ -105,10 +133,12 @@ if [[ $1 == "blackhole" ]]; then
|
|
|
|
|
sync_blackhole
|
|
|
|
|
elif [[ $1 == "test" ]]; then
|
|
|
|
|
sync_test
|
|
|
|
|
elif [[ $1 == "validate" ]]; then
|
|
|
|
|
validate "$2"
|
|
|
|
|
elif [[ $1 == "docker" ]]; then
|
|
|
|
|
sync_docker
|
|
|
|
|
else
|
|
|
|
|
echo "valid options are: blackhole | test | docker"
|
|
|
|
|
echo "valid options are: blackhole | test | validate | docker"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|