From d66e2b77fdaaa87e98d894d1e4d7d9a3fd28a728 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Thu, 10 Feb 2022 11:16:57 +0100 Subject: [PATCH] Run flake8 linter on github workflow --- .github/workflows/flask.yml | 14 +++++++++++--- tox.ini | 8 ++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 tox.ini diff --git a/.github/workflows/flask.yml b/.github/workflows/flask.yml index 151cc26d..328533a8 100644 --- a/.github/workflows/flask.yml +++ b/.github/workflows/flask.yml @@ -47,9 +47,6 @@ jobs: sudo apt-get update -qy sudo apt-get -y install postgresql-client python -m pip install --upgrade pip - pip install virtualenv - virtualenv env - source env/bin/activate pip install flake8 pytest coverage pip install -r requirements.txt @@ -65,6 +62,17 @@ jobs: psql -h "localhost" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION citext SCHEMA public;" psql -h "localhost" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION pg_trgm SCHEMA public;" + - name: Lint with flake8 + run: | + # stop the build if: + # - E9,F63,F7,F82: Python syntax errors or undefined names + # - E501: line longer than 120 characters + # - C901: complexity greater than 10 + # - F401: modules imported but unused + # See: https://flake8.pycqa.org/en/latest/user/error-codes.html + flake8 . --select=E9,F63,F7,F82,E501,C901,F401 + flake8 . --exit-zero + - name: Run Tests run: | export SECRET_KEY=`python3 -c 'import secrets; print(secrets.token_hex())'` diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..2f5d68fc --- /dev/null +++ b/tox.ini @@ -0,0 +1,8 @@ +[flake8] +count = True +exclude = + migrations +max-complexity = 10 +max-line-length = 120 +show-source = True +statistics = True