Run flake8 linter on github workflow

This commit is contained in:
Santiago L 2022-02-10 11:16:57 +01:00
parent f2d6c198cc
commit d66e2b77fd
2 changed files with 19 additions and 3 deletions

View File

@ -47,9 +47,6 @@ jobs:
sudo apt-get update -qy sudo apt-get update -qy
sudo apt-get -y install postgresql-client sudo apt-get -y install postgresql-client
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install virtualenv
virtualenv env
source env/bin/activate
pip install flake8 pytest coverage pip install flake8 pytest coverage
pip install -r requirements.txt 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 citext SCHEMA public;"
psql -h "localhost" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION pg_trgm 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 - name: Run Tests
run: | run: |
export SECRET_KEY=`python3 -c 'import secrets; print(secrets.token_hex())'` export SECRET_KEY=`python3 -c 'import secrets; print(secrets.token_hex())'`

8
tox.ini Normal file
View File

@ -0,0 +1,8 @@
[flake8]
count = True
exclude =
migrations
max-complexity = 10
max-line-length = 120
show-source = True
statistics = True