Add `pre-commit` with `black`, `isort` and `flake8`.

master
Fabio Caccamo 2022-10-14 17:29:11 +02:00
parent bf72f6c982
commit aecfbf0291
4 changed files with 55 additions and 0 deletions

5
.flake8 100644
View File

@ -0,0 +1,5 @@
[flake8]
ignore = E203, E266, E501, W503, F403, F401, F841
max-line-length = 89
max-complexity = 10
select = B,C,E,F,W,T4,B9

View File

@ -0,0 +1,29 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/ambv/black
rev: 22.10.0
hooks:
- id: black
language_version: python3.8
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
exclude: "setup.py"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
# - id: end-of-file-fixer
# - id: check-yaml
# - id: check-added-large-files

20
pyproject.toml 100644
View File

@ -0,0 +1,20 @@
[tool.black]
py38 = true
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
# The following are specific to Black, you probably don't want those.
| blib2to3
| tests/data
)/
'''

View File

@ -1,4 +1,5 @@
codecov codecov
coverage coverage
pre-commit == 2.20.0
psycopg2 psycopg2
tox tox