Supported hooks
featured hooks ¶
here are a few hand-picked repositories which provide pre-commit integrations.
these are fairly popular and are generally known to work well in most setups!
this list is not intended to be exhaustive
provided by the pre-commit team:
- pre-commit/pre-commit-hooks: a handful of language-agnostic hooks which are universally useful!
- pre-commit/pygrep-hooks: a few quick regex-based hooks for a handful of quick syntax checks
- pre-commit/sync-pre-commit-deps: sync pre-commit hook dependencies based on other installed hooks
- pre-commit/mirrors-*: pre-commit mirrors of a handful of popular tools
for python projects:
- asottile/pyupgrade: automatically upgrade syntax for newer versions of the language
- asottile/(others): a few other repos by the pre-commit creator
- psf/black: The uncompromising Python code formatter
- hhatto/autopep8: automatically fixes PEP8 violations
- astral-sh/ruff-pre-commit: the ruff linter and formatter for python
- google/yapf: a highly configurable python formatter
- PyCQA/flake8: a linter framework for python
- PyCQA/isort: an import sorter for python
- PyCQA/(others): a few other python code quality tools
- adamchainz/django-upgrade: automatically upgrade your Django project code
for shell scripts:
- shellcheck-py/shellcheck-py: runs shellcheck on your scripts
- openstack/bashate: code style enforcement for bash programs
for the web:
- biomejs/pre-commit: a fast formatter / fixer written in rust
- standard/standard: linter / fixer
- shssoichiro/oxipng: optimize png files
for configuration files:
- python-jsonschema/check-jsonschema: check many common configurations with jsonschema
- rhysd/actionlint: lint your GitHub Actions workflow files
- google/yamlfmt: a formatter for yaml files
- adrienverge/yamllint: a linter for YAML files
for text / docs / prose:
- crate-ci/typos: find and fix common typographical errors
- thlorenz/doctoc: generate a table-of-contents in markdown files
- amperser/proselint: A linter for prose.
- markdownlint/markdownlint: a Markdown lint tool
- codespell-project/codespell: check code for common misspellings
for linting commit messages:
for secret scanning / security:
for other programming languages:
- realm/SwiftLint: enforce Swift style and conventions
- nicklockwood/SwiftFormat: a formatter for Swift
- AleksaC/terraform-py: format and validate terraform syntax
- rubocop/rubocop: static analysis and formatting for Ruby
- bufbuild/buf: tooling for Protocol Buffers
- sqlfluff/sqlfluff: a modular linter and auto formatter for SQL
- aws-cloudformation/cfn-lint: aws CloudFormation linter
- google/go-jsonnet: linter / formatter for jsonnet
- JohnnyMorganz/StyLua: an opinionated Lua code formatter
- Koihik/LuaFormatter: a formatter for Lua code
- mrtazz/checkmake: linter for Makefile syntax
- nbqa-dev/nbqa: run common linters on Jupyter Notebooks
finding hooks ¶
it's recommended to use your favorite searching tool to find existing hooks to use in your project.
for example, here's some searches you may find useful using sourcegraph:
- hooks which run on python files:
file:^\.pre-commit-hooks\.yaml$ "types: [python]"
- hooks which run on shell files:
file:^\.pre-commit-hooks\.yaml$ "types: [shell]"
- pre-commit configurations in popular projects:
file:^\.pre-commit-config\.yaml$
you may also find github's search useful as well, though its querying and sorting capabilities are quite limited plus it requires a login:
- repositories providing hooks:
path:.pre-commit-hooks.yaml language:YAML
adding to this page ¶
the previous iteration of this page was a laundry list of hooks and maintaining quality of the listed tools was cumbersome.
this page is not intended to be exhaustive
you may send a pull request to expand this list however there are a few requirements you must follow or your PR will be closed without comment:
- the tool must already be fairly popular (>500 stars)
- the tool must use a managed language (no
system
/script
/docker
hooks) - the tool must operate on files