diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 20cf7fb33..8b76b571b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,7 +16,7 @@ jobs: run: | python -m pip install --upgrade pip pip install tox - - name: Run lint 💅 + - name: Run pre-commit 💅 run: tox env: - TOXENV: flake8 + TOXENV: pre-commit diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..cb9fab419 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +default_language_version: + python: python3.8 +repos: +- repo: https://github.com/PyCQA/flake8 + rev: 5.0.4 + hooks: + - id: flake8 + additional_dependencies: [flake8-bugbear==22.7.1] diff --git a/setup.py b/setup.py index e6615b889..974332890 100644 --- a/setup.py +++ b/setup.py @@ -27,9 +27,9 @@ dev_requires = [ "black==19.10b0", - "flake8==3.7.9", - "flake8-black==0.1.1", - "flake8-bugbear==20.1.4", + "flake8>=5,<6", + "flake8-black==0.3.3", + "flake8-bugbear==22.7.1", ] + tests_require setup( diff --git a/tox.ini b/tox.ini index e8d01881d..9b4bdd1e0 100644 --- a/tox.ini +++ b/tox.ini @@ -45,8 +45,8 @@ deps = -e.[dev] commands = black --exclude "/migrations/" graphene_django examples setup.py --check -[testenv:flake8] -basepython = python3.8 -deps = -e.[dev] +[testenv:pre-commit] +skip_install = true +deps = pre-commit commands = - flake8 graphene_django examples setup.py + pre-commit run --all-files --show-diff-on-failure