Skip to content

Instantly share code, notes, and snippets.

@shresthakamal
Last active November 3, 2024 06:16
Show Gist options
  • Save shresthakamal/34ff61afaf742828d83f58485f0cf76d to your computer and use it in GitHub Desktop.
Save shresthakamal/34ff61afaf742828d83f58485f0cf76d to your computer and use it in GitHub Desktop.
Sample pre-commit hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- id: name-tests-test
- id: requirements-txt-fixer
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.14.0
hooks:
- id: reorder-python-imports
args: [--py39-plus, --add-import, 'from __future__ import annotations']
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
hooks:
- id: pyupgrade
args: [--py39-plus]
- repo: https://github.com/hhatto/autopep8
rev: v2.3.1
hooks:
- id: autopep8
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8
args: ['--ignore=E501,E265,W503']
- repo: https://github.com/timothycrosley/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
hooks:
- id: mypy
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
- repo: local
hooks:
- id: block-env-files
name: Block .env Files
entry: bash -c 'if git diff --cached --name-only | grep -q "^\.env"; then echo ".env files are not allowed in commits"; exit 1; fi'
language: system
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment