Skip to content
README.md 732 B
Newer Older
# `pre-commit-hooks`

> Bazel `pre-commit` hooks

## Getting Started

Add the following to `MODULE.bazel`:

```py
bazel_dep(name = "pre-commit", version = "<version>")
bazel_dep(name = "pre-commit-hooks", version = "<version>")
```

Create a `hooks` directory to create the `pre-commit` configuration:

```py
load("@pre-commit//pre-commit:defs.bzl", "pre_commit")

pre_commit(
    name = "hooks",
    srcs = ["@pre-commit-hooks"],
)
```

## Usage

Install the hooks with `bazelisk run -- hooks:install`.

Run the hooks with `bazelisk run -- hooks`.

## Hermeticity

The project uses `rules_python` which is hermetic when `--@rules_python//python/config_settings:bootstrap_impl` is set to `script`.

All hooks provided are hermetic.