From 70dcfaec8b75777327aa97ebee1964d59762f829 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 22 Mar 2021 00:29:43 +0100 Subject: [PATCH 1/2] GitHub Action to lint Python code --- .github/workflows/lint_python.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/lint_python.yml diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml new file mode 100644 index 0000000..6ef300b --- /dev/null +++ b/.github/workflows/lint_python.yml @@ -0,0 +1,20 @@ +name: lint_python +on: [pull_request, push] +jobs: + lint_python: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: pip install bandit black codespell flake8 isort mypy pytest pyupgrade safety + - run: bandit -r . || true + - run: black --check . || true + - run: codespell --quiet-level=2 || true # --ignore-words-list="" --skip="" + - run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + - run: isort --check-only --profile black . || true + - run: pip install -r requirements.txt || true + - run: mypy --ignore-missing-imports . || true + - run: pytest . || true + - run: pytest --doctest-modules . || true + - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true + - run: safety check From 63ea11f7768416da296aec244b3654559f97b8f8 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 22 Mar 2021 00:33:54 +0100 Subject: [PATCH 2/2] Make flake8 and pytest mandatory tests --- .github/workflows/lint_python.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml index 6ef300b..e46d1a5 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -10,11 +10,11 @@ jobs: - run: bandit -r . || true - run: black --check . || true - run: codespell --quiet-level=2 || true # --ignore-words-list="" --skip="" - - run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + - run: flake8 . --count --show-source --statistics - run: isort --check-only --profile black . || true - run: pip install -r requirements.txt || true - run: mypy --ignore-missing-imports . || true - - run: pytest . || true + - run: pytest . - run: pytest --doctest-modules . || true - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true - run: safety check