Skip to content

Instantly share code, notes, and snippets.

@os-ia
Last active June 17, 2022 07:49
Show Gist options
  • Save os-ia/6d60ede184337bdb081c32f7c2107248 to your computer and use it in GitHub Desktop.
Save os-ia/6d60ede184337bdb081c32f7c2107248 to your computer and use it in GitHub Desktop.
Example pre-commit config for Python projects
repos:
- repo: meta
hooks:
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: fix-encoding-pragma
args: ["--remove"]
- id: mixed-line-ending
- id: name-tests-test
- id: pretty-format-json
args: ["--autofix"]
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.2.3
hooks:
- id: add-trailing-comma
args: ["--py36-plus"]
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.1.0
hooks:
- id: reorder-python-imports
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.20.1
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
args: ["--max-line-length=120"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.950
hooks:
- id: mypy
additional_dependencies:
- types-toml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment