Introduce pre-commit config for flake8 (#1338)

This commit is contained in:
Ülgen Sarıkavak 2022-08-18 12:48:51 +03:00 committed by GitHub
parent ed4ee98596
commit 12ec3ca4ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 9 deletions

View File

@ -16,7 +16,7 @@ jobs:
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install tox pip install tox
- name: Run lint 💅 - name: Run pre-commit 💅
run: tox run: tox
env: env:
TOXENV: flake8 TOXENV: pre-commit

8
.pre-commit-config.yaml Normal file
View File

@ -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]

View File

@ -27,9 +27,9 @@ tests_require = [
dev_requires = [ dev_requires = [
"black==19.10b0", "black==19.10b0",
"flake8==3.7.9", "flake8>=5,<6",
"flake8-black==0.1.1", "flake8-black==0.3.3",
"flake8-bugbear==20.1.4", "flake8-bugbear==22.7.1",
] + tests_require ] + tests_require
setup( setup(

View File

@ -45,8 +45,8 @@ deps = -e.[dev]
commands = commands =
black --exclude "/migrations/" graphene_django examples setup.py --check black --exclude "/migrations/" graphene_django examples setup.py --check
[testenv:flake8] [testenv:pre-commit]
basepython = python3.8 skip_install = true
deps = -e.[dev] deps = pre-commit
commands = commands =
flake8 graphene_django examples setup.py pre-commit run --all-files --show-diff-on-failure