Files
releases/docs/projects/regal/pre-commit-hooks.md
T
Charlie Egan 7b004efe4a docs: Update documentation to be more consistent and sound more like reference docs (#8786)
There are a lot of edits here. I am trying to make the docs more
consistent between pages and sections, each commit is one category of
change so it might be easier to go through commit by commit to see all
similar changes in the same place.

The main goal was to make the language sound more like reference docs
than product marketing, i.e. a little more formal with fewer filler
words in places. Rephrase to avoid informal 'we/our' guidance,
formatting updates for things like admonitions.

---------

Signed-off-by: Charlie Egan <charlie_egan@apple.com>
2026-06-16 09:44:47 +00:00

2.6 KiB

sidebar_position, sidebar_label
sidebar_position sidebar_label
6 Pre-Commit Hooks
<head> </head>

Pre-Commit Hooks

Pre-Commit is a framework for managing and maintaining multi-language pre-commit hooks. This allows running Regal automatically whenever (and as the name implied before) a Rego file is about to be committed.

To use Regal with pre-commit, add this to your .pre-commit-config.yaml

- repo: https://github.com/open-policy-agent/regal
  rev: v0.7.0 # Use the ref you want to point at
  hooks:
    - id: regal-lint
  # -   id: ...

Hooks Available

regal-lint

commit-msg hook

Runs Regal against all staged .rego files, aborting the commit if any fail.

  • requires the go build chain is installed and available on $PATH
  • will build and install the tagged version of Regal in an isolated GOPATH
  • ensures compatibility between versions

regal-lint-use-path

commit-msg hook

Runs Regal against all staged .rego files, aborting the commit if any fail.

  • requires the regal package is already installed and available on $PATH.

regal-download

commit-msg hook

Runs Regal against all staged .rego files, aborting the commit if any fail.

  • Downloads the latest regal binary from GitHub.

regal-fix

commit-msg hook

Runs regal fix against all staged .rego files, applying any auto-fixable rule violations in place. Use this alongside regal-lint when you want the hook to repair style-level issues automatically rather than asking the contributor to re-run regal fix themselves.

  • requires the go build chain is installed and available on $PATH
  • will build and install the tagged version of Regal in an isolated GOPATH
  • ensures compatibility between versions

regal-fix-use-path

commit-msg hook

Same as regal-fix, but uses the regal binary already on $PATH.

  • requires the regal package is already installed and available on $PATH.

regal-fix-download

commit-msg hook

Same as regal-fix, but downloads the latest regal binary from GitHub instead of building or relying on $PATH.

  • Downloads the latest regal binary from GitHub.