From 9931edccc452f8624149dd61360f69f4da525f8f Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 27 Jul 2021 12:06:47 +0200 Subject: [PATCH 1/3] GitHub Action to lint Python code Output: --- .github/workflows/lint_python.yml | 21 +++++++++++++++++++++ 1 file changed, 21 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..f70fb93 --- /dev/null +++ b/.github/workflows/lint_python.yml @@ -0,0 +1,21 @@ +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 --recursive --skip B101 . || true # B101 is assert statements + - run: black --check . || true + - run: codespell || true # --ignore-words-list="" --skip="" + - run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + - run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --show-source --statistics + - run: isort --check-only --profile black . || true + - run: pip install -r requirements.txt || true + - run: mypy --install-types --non-interactive . || true + - run: pytest . || true + - run: pytest --doctest-modules . || true + - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true + - run: safety check From 3f2058441a193b87c50b763ccf00b2eae86746f6 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 27 Jul 2021 12:09:52 +0200 Subject: [PATCH 2/3] bandit --recursive --skip B108,B112,B404,B602 . --- .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 f70fb93..03a58d4 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -7,8 +7,8 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - run: pip install bandit black codespell flake8 isort mypy pytest pyupgrade safety - - run: bandit --recursive --skip B101 . || true # B101 is assert statements - - run: black --check . || true + - run: bandit --recursive --skip B108,B112,B404,B602 . + - run: black --check . - run: codespell || true # --ignore-words-list="" --skip="" - run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --show-source --statistics From b500ee94293b618fc170946f66061a7b7616239e Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 27 Jul 2021 12:11:31 +0200 Subject: [PATCH 3/3] codespell --- .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 03a58d4..4f742d0 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -8,8 +8,8 @@ jobs: - uses: actions/setup-python@v2 - run: pip install bandit black codespell flake8 isort mypy pytest pyupgrade safety - run: bandit --recursive --skip B108,B112,B404,B602 . - - run: black --check . - - run: codespell || true # --ignore-words-list="" --skip="" + - run: black --check . || true + - run: codespell - run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --show-source --statistics - run: isort --check-only --profile black . || true