Browse Source

Add pre-commit hooks

Andreas Berthoud 5 years ago
parent
commit
29e6fceb33
  1. 35
      .pre-commit-config.yaml
  2. 15
      pyproject.toml
  3. 15
      setup.cfg

35
.pre-commit-config.yaml

@ -0,0 +1,35 @@
repos:
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.7.0 # https://github.com/pre-commit/mirrors-isort/tags
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 20.8b1 # https://github.com/psf/black/tags
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.0 # https://gitlab.com/pycqa/flake8/-/tags
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812 # https://github.com/pre-commit/mirrors-mypy/tags
hooks:
- id: mypy
exclude: 'docs'
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.1.0 # https://github.com/asottile/add-trailing-comma/tags
hooks:
- id: add-trailing-comma
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0 # https://github.com/pre-commit/pre-commit-hooks/tags
hooks:
- id: check-json
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: requirements-txt-fixer

15
pyproject.toml

@ -0,0 +1,15 @@
[tool.isort]
profile = "hug"
force_single_line = true
[tool.black]
# line-length = 88 # default. adapt if necessary, must be in sync with flake8 config
exclude = '''
(
/(
| \.git # root of the project
| \venv*
| nucleo*
)/
)
'''

15
setup.cfg

@ -0,0 +1,15 @@
[tool:pytest]
pep8ignore = E501
[flake8]
# ignore errors and warnings
# - whitespace before ':', see https://github.com/psf/black/issues/315
# - line break before binary operator, see https://github.com/psf/black/issues/52
ignore = E203, W503
# must be in sync with 'black' formatter config in pyproject.toml
max-line-length = 88
[mypy]
ignore_missing_imports = True
exclude=docs/
Loading…
Cancel
Save