Call black via pre-commit

This commit is contained in:
Ülgen Sarıkavak 2022-08-18 14:28:38 +03:00
parent e980cede38
commit 858ffd4fbb
4 changed files with 8 additions and 12 deletions

View File

@ -1,8 +1,14 @@
default_language_version: default_language_version:
python: python3.10 python: python3.10
repos: repos:
- repo: https://github.com/PyCQA/flake8 - repo: https://github.com/PyCQA/flake8
rev: 5.0.4 rev: 5.0.4
hooks: hooks:
- id: flake8 - id: flake8
additional_dependencies: [flake8-bugbear==22.7.1] additional_dependencies: [flake8-bugbear==22.7.1]
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black

View File

@ -14,11 +14,7 @@ test: tests # Alias test -> tests
.PHONY: format .PHONY: format
format: format:
black --exclude "/migrations/" graphene_django examples setup.py pre-commit run --all-files
.PHONY: lint
lint:
flake8 graphene_django examples
.PHONY: docs ## Generate docs .PHONY: docs ## Generate docs
docs: dev-setup docs: dev-setup

View File

@ -26,7 +26,7 @@ tests_require = [
dev_requires = [ dev_requires = [
"black==19.10b0", "black==22.6.0",
"flake8>=5,<6", "flake8>=5,<6",
"flake8-black==0.3.3", "flake8-black==0.3.3",
"flake8-bugbear==22.7.1", "flake8-bugbear==22.7.1",

View File

@ -39,12 +39,6 @@ deps =
djangomaster: https://github.com/django/django/archive/master.zip djangomaster: https://github.com/django/django/archive/master.zip
commands = {posargs:py.test --cov=graphene_django graphene_django examples} commands = {posargs:py.test --cov=graphene_django graphene_django examples}
[testenv:black]
basepython = python3.10
deps = -e.[dev]
commands =
black --exclude "/migrations/" graphene_django examples setup.py --check
[testenv:pre-commit] [testenv:pre-commit]
basepython = python3.10 basepython = python3.10
skip_install = true skip_install = true