diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml index 7f7c737..d34cfdc 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -12,7 +12,7 @@ jobs: - run: bandit --recursive --skip B105,B108,B404,B603,B607 . - run: black --check --diff --line-length 79 . - 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 - run: isort --check-only --line-length 79 --profile black . # - run: pip install -r tubearchivist/requirements.txt diff --git a/deploy.sh b/deploy.sh index 0edaaa2..c9954d3 100755 --- a/deploy.sh +++ b/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 { # 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