Skip to content

cconverse711/awesome-pre-commit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Awesome pre-commit

A curated list of awesome pre-commit hooks and related resources.

The official list of supported hooks was previously a great resource for discovering new hooks. The new suggested approach of finding hooks works ok, but it can still be difficult to find what you're looking for, or discover new hooks you didn't know you needed. This repo seeks primarily to serve as that resource.

Hooks

C/C++

CMake

Dockerfile

Documentation

Images

JSON

Makefile

Markdown

Protocol Buffers

Python

Shell

Spellchecking

YAML

Additional Resources and Tips

Installing with uv

Use uv to speed up installation of python-based hooks:

uv tool install pre-commit --with pre-commit-uv

For more information, refer to https://adamj.eu/tech/2025/05/07/pre-commit-install-uv/

Replacements

  • prek
    • Faster
    • Uses less disk space
    • Other enhancements

Tool Setup

When using pre-commit on a development team, it is important for all developers to be using the same versions of the tools that their pre-commit hooks depend on. For many hooks, pre-commit will automatically bootstrap the appropriate package manager (if needed) and install the tools into a Python virtual environment for you; unfortunately other hooks rely on system-installed tools that pre-commit must assume are available. To work around this, there are several options:

additional_dependencies

When you need to use a hook whose language supports the additional_dependencies property, check if the language's package manager has an implementation of the tool, and specify it there. This is somewhat common for Python.

As an example, the hooks for the https://github.com/pocc/pre-commit-hooks repo will not install the tools automatically. But many of the tools can be installed automatically by pre-commit via pip, just by adding the appropriate values to additional_dependencies, such as clang-format or clang-tidy -- just remember to pin the package version!

Dev Environments

Set up a dev environment containing your desired pre-commit hook dependencies (as well as other dependencies) using one of the available options:

  • Dev Containers
    • Docker-based
    • Integrates into popular code editors
  • Nix Package Manager
  • Devbox
    • Nix-based (but more user-friendly)
    • Can be hosted in the Cloud
    • Can generate Dev Container definitions and Dockerfiles
  • Pixi
    • Conda-based

When using a non-Docker-based dev environment, it is highly recommended to use direnv (or similar) to automatically activate your dev environment when you enter your project's directory.

About

A curated list of awesome pre-commit hooks and related resources

Topics

Resources

Stars

Watchers

Forks