From 4fbef50d71c8beebfc89e6cf4b4a64730049afc9 Mon Sep 17 00:00:00 2001 From: jo Date: Sat, 19 Nov 2022 16:38:51 +0100 Subject: [PATCH] chore: add flake8 pre-commit hook Part-of: --- .flake8 | 11 +++++++++++ .gitlab-ci.yml | 19 ------------------- .pre-commit-config.yaml | 5 +++++ api/setup.cfg | 5 ----- 4 files changed, 16 insertions(+), 24 deletions(-) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 000000000..0fd04468c --- /dev/null +++ b/.flake8 @@ -0,0 +1,11 @@ +# Use .flake8 file until pyproject.toml is supported +# See https://github.com/PyCQA/flake8/issues/234 +[flake8] +max-line-length = 120 +extend-exclude = + */migrations/* +extend-ignore = + F405 + W503 + E203 + E741 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 08131470b..7719b5f02 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -166,25 +166,6 @@ black: changes: - api/**/* -flake8: - interruptible: true - image: python:3.7 - stage: lint - variables: - GIT_STRATEGY: fetch - before_script: - - pip install 'flake8<3.7' - script: - - flake8 -v api - cache: - key: "$CI_PROJECT_ID__flake8_pip_cache" - paths: - - "$PIP_CACHE_DIR" - rules: - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - changes: - - api/**/* - eslint: interruptible: true image: node:18-alpine diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 34a7535eb..fadfd49a8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,3 +23,8 @@ repos: exclude: ^(docs/locales/.*/LC_MESSAGES) - id: mixed-line-ending - id: trailing-whitespace + + - repo: https://github.com/pycqa/flake8 + rev: 5.0.4 + hooks: + - id: flake8 diff --git a/api/setup.cfg b/api/setup.cfg index 1f09309bd..a30756860 100644 --- a/api/setup.cfg +++ b/api/setup.cfg @@ -1,8 +1,3 @@ -[flake8] -max-line-length = 120 -exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,tests/data,tests/music/conftest.py -ignore = F405,W503,E203,E741 - [isort] skip_glob = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules