mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 11:50:14 +00:00
Reducing max-complexity to 12 after code refactor #25
* Added helper function in deploy.sh to run same tests as github actions locally
This commit is contained in:
parent
fd50058431
commit
023b5a4aba
2
.github/workflows/lint_python.yml
vendored
2
.github/workflows/lint_python.yml
vendored
@ -12,7 +12,7 @@ jobs:
|
|||||||
- run: bandit --recursive --skip B105,B108,B404,B603,B607 .
|
- run: bandit --recursive --skip B105,B108,B404,B603,B607 .
|
||||||
- run: black --check --diff --line-length 79 .
|
- run: black --check --diff --line-length 79 .
|
||||||
- run: codespell
|
- run: codespell
|
||||||
- run: flake8 . --count --max-complexity=16 --max-line-length=79
|
- run: flake8 . --count --max-complexity=12 --max-line-length=79
|
||||||
--show-source --statistics
|
--show-source --statistics
|
||||||
- run: isort --check-only --line-length 79 --profile black .
|
- run: isort --check-only --line-length 79 --profile black .
|
||||||
# - run: pip install -r tubearchivist/requirements.txt
|
# - run: pip install -r tubearchivist/requirements.txt
|
||||||
|
32
deploy.sh
32
deploy.sh
@ -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 {
|
function sync_docker {
|
||||||
|
|
||||||
# check things
|
# check things
|
||||||
@ -105,10 +133,12 @@ if [[ $1 == "blackhole" ]]; then
|
|||||||
sync_blackhole
|
sync_blackhole
|
||||||
elif [[ $1 == "test" ]]; then
|
elif [[ $1 == "test" ]]; then
|
||||||
sync_test
|
sync_test
|
||||||
|
elif [[ $1 == "validate" ]]; then
|
||||||
|
validate "$2"
|
||||||
elif [[ $1 == "docker" ]]; then
|
elif [[ $1 == "docker" ]]; then
|
||||||
sync_docker
|
sync_docker
|
||||||
else
|
else
|
||||||
echo "valid options are: blackhole | test | docker"
|
echo "valid options are: blackhole | test | validate | docker"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user