diff --git a/scripts/check-python.sh b/scripts/check-python.sh index 04365a0..065e5e0 100755 --- a/scripts/check-python.sh +++ b/scripts/check-python.sh @@ -3,15 +3,19 @@ set -e echo "Installing dependencies if necessary" -python3 -m pip install --upgrade autoflake isort black black[jupyter] mypy flake8 +python3 -m pip install --upgrade autoflake isort black[jupyter] mypy flake8 echo "Checking $1" -python3 -m autoflake --expand-star-imports --remove-all-unused-imports --ignore-init-module-imports --remove-unused-variables --in-place -r $1 --check -python3 -m isort --profile black --skip .env $1 --check -python3 -m black $1 --exclude .env --check +cd $1 -yes | python3 -m mypy $1 --install-types > /dev/null || true -python3 -m mypy --namespace-packages --ignore-missing-imports --install-types --non-interactive --disallow-untyped-defs --disallow-incomplete-defs --follow-imports=silent --exclude=external/ --exclude=/build/ --pretty $1 +python3 -m autoflake --expand-star-imports --remove-all-unused-imports --ignore-init-module-imports --remove-unused-variables --in-place -r . --check +python3 -m isort --profile black --skip .env . --check +python3 -m black . --exclude .env --check -python3 -m flake8 $1 --count --show-source --statistics --exclude=__init__.py,.env,external --ignore=E501,E402,F821,W503,E722,E203 +yes | python3 -m mypy . --install-types > /dev/null || true +python3 -m mypy --namespace-packages --ignore-missing-imports --install-types --non-interactive --disallow-untyped-defs --disallow-incomplete-defs --follow-imports=silent --exclude=external/ --exclude=/build/ --pretty . + +python3 -m flake8 . --count --show-source --statistics --exclude=__init__.py,.env,external --ignore=E501,E402,F821,W503,E722,E203 + +cd - diff --git a/scripts/format-python.sh b/scripts/format-python.sh index 298bd7b..0eb3661 100755 --- a/scripts/format-python.sh +++ b/scripts/format-python.sh @@ -1,20 +1,24 @@ -#!/bin/bash +#!/bin/sh set -e echo "Installing dependencies if necessary" -python3 -m pip install --upgrade autoflake isort black black[jupyter] mypy +python3 -m pip install --upgrade autoflake isort black[jupyter] mypy echo "Formatting and checking $1" +cd $1 + echo Running autoflake -python3 -m autoflake --expand-star-imports --remove-all-unused-imports --ignore-init-module-imports --remove-unused-variables --in-place -r $1 +python3 -m autoflake --expand-star-imports --remove-all-unused-imports --ignore-init-module-imports --remove-unused-variables --in-place -r . echo Running isort -python3 -m isort --profile black --skip .env $1 +python3 -m isort --profile black --skip .env . echo Running black -python3 -m black $1 --exclude .env +python3 -m black . --exclude .env echo Running mypy -python3 -m mypy --namespace-packages --ignore-missing-imports --install-types --non-interactive --disallow-untyped-defs --disallow-incomplete-defs --pretty --follow-imports=silent --exclude=external/ --exclude=/build/ $1 \ No newline at end of file +python3 -m mypy --namespace-packages --ignore-missing-imports --install-types --non-interactive --disallow-untyped-defs --disallow-incomplete-defs --pretty --follow-imports=silent --exclude=external/ --exclude=/build/ . + +cd -