Skip to content

Instantly share code, notes, and snippets.

@mh0w
Created December 4, 2024 13:24
Show Gist options
  • Save mh0w/5a371c93c510a41dd69285bd2879c1a9 to your computer and use it in GitHub Desktop.
Save mh0w/5a371c93c510a41dd69285bd2879c1a9 to your computer and use it in GitHub Desktop.
Python pre-commit hooks
# Example pre commit hooks
repos:
- repo: local
hooks:
- id: flake8
name: flake8
entry: flake8
stages: [commit]
language: system
types: [python]
exclude: 'cli/pipeline_template'
- repo: local
hooks:
- id: pydocstyle
name: pydocstyle
entry: pydocstyle
stages: [commit]
language: system
types: [python]
exclude: 'cli/pipeline_template'
- repo: local
hooks:
- id: black
name: black
entry: black
language: system
types: [python]
exclude: 'cli/pipeline_template'
- repo: local
hooks:
- id: isort
name: isort (python)
entry: black
language: system
types: [python]
exclude: 'cli/pipeline_template'
# Create .pre-commit-config.yaml, install pre-commit, pre-commit run
pip3 install pre-commit
pre-commit run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment