Skip to content

Instantly share code, notes, and snippets.

@pohlt
Last active November 3, 2021 18:39
Show Gist options
  • Save pohlt/d60b574fc1c6d9cdc1c6dfb68e7b7742 to your computer and use it in GitHub Desktop.
Save pohlt/d60b574fc1c6d9cdc1c6dfb68e7b7742 to your computer and use it in GitHub Desktop.
Starting point for a Python-centric pre-commit
default_language_version:
python: python3.9
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.0.1'
hooks:
- id: mixed-line-ending
args: [ '--fix=lf' ]
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-json
- id: check-added-large-files
args: [ '--maxkb=64' ]
- id: check-merge-conflict
- id: fix-encoding-pragma
args: [ '--remove' ]
- repo: https://github.com/pycqa/isort
rev: '5.10.0'
hooks:
- id: isort
args: [ '--profile', 'black' ]
# NOTE: your .editorconfig might mess with the isort settings (e.g. line length)
- repo: https://github.com/psf/black
rev: '21.10b0'
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: '4.0.1'
hooks:
- id: flake8
# see https://github.com/PyCQA/pycodestyle/issues/373 for E203
# see https://github.com/psf/black/issues/113 for W503
args: [ '--ignore=E203,W503', '--max-line-length=88' ]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.910-1'
hooks:
- id: mypy
args: [ '--ignore-missing-imports', '--strict' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment