default_stages = ["pre-commit"]
minimum_prek_version = "0.3.2"
# All available: commit-msg, post-checkout, post-commit, post-merge, post-rewrite, pre-commit, pre-merge-commit, pre-push, pre-rebase, prepare-commit-msg
default_install_hook_types = ["commit-msg", "post-checkout", "pre-commit", "pre-push"]
[[repos]]
repo = "builtin"
hooks = [
{ id = "trailing-whitespace", priority = 0 },
{ id = "end-of-file-fixer", priority = 0 },
{ id = "check-yaml", args = ["--allow-multiple-documents"], priority = 0 },
{ id = "check-toml", priority = 0 },
{ id = "check-json", priority = 0 },
{ id = "check-added-large-files", priority = 0 },
{ id = "check-merge-conflict", priority = 0 },
{ id = "check-case-conflict", priority = 0 },
{ id = "check-symlinks", priority = 0 },
{ id = "check-executables-have-shebangs", priority = 0 },
{ id = "mixed-line-ending", args = ["--fix=lf"], priority = 0 },
{ id = "detect-private-key", priority = 0 },
]
[[repos]]
repo = "https://github.com/detailobsessed/sync-with-uv"
rev = "v0.6.0-prek" # prek autoupdate will fill this
hooks = [{ id = "sync-with-uv", priority = 0 }]
[[repos]]
repo = "https://github.com/gitleaks/gitleaks"
rev = "v8.30.0" # prek autoupdate will fill this
hooks = [{ id = "gitleaks", priority = 1 }]
[[repos]]
repo = "https://github.com/astral-sh/ruff-pre-commit"
rev = "v0.15.2" # prek autoupdate will fill this
hooks = [
{ id = "ruff", args = ["--fix"], priority = 1 },
{ id = "ruff-format", priority = 1 },
]
[[repos]]
repo = "https://github.com/astral-sh/uv-pre-commit"
rev = "0.10.6" # prek autoupdate will fill this
hooks = [{ id = "uv-lock", priority = 1 }]
[[repos]]
repo = "https://github.com/shellcheck-py/shellcheck-py"
rev = "v0.11.0.1" # prek autoupdate will fill this
hooks = [{ id = "shellcheck", priority = 1 }]
[[repos]]
repo = "https://github.com/rhysd/actionlint"
rev = "v1.7.11" # prek autoupdate will fill this
hooks = [{ id = "actionlint", priority = 1 }]
[[repos]]
repo = "https://github.com/crate-ci/typos"
rev = "v1.43.5" # prek autoupdate will fill this
hooks = [{ id = "typos", priority = 1 }]
[[repos]]
repo = "https://github.com/igorshubovych/markdownlint-cli"
rev = "v0.47.0" # prek autoupdate will fill this
hooks = [{ id = "markdownlint", args = ["--fix", "--ignore", "CHANGELOG.md"], priority = 1 }]
[[repos]]
repo = "https://github.com/lycheeverse/lychee"
rev = "lychee-v0.23.0"
hooks = [{ id = "lychee", args = ["--config", ".lychee.toml"], priority = 1, types_or = ["markdown", "html", "rst", "yaml"] }]
[[repos]]
repo = "local"
[[repos.hooks]]
id = "no-commit-to-main"
name = "prevent pushes to main"
entry = "bash -c 'test \"$(git rev-parse --abbrev-ref HEAD)\" != main || { echo Direct pushes to main not allowed. Use a branch + PR. && exit 1; }'"
language = "system"
always_run = true
pass_filenames = false
stages = ["pre-push"]
priority = 0
[[repos.hooks]]
id = "check-shebang-scripts-are-executable"
name = "check scripts with shebangs are executable"
entry = "bash -c 'fail=0; for f in \"$@\"; do if head -c2 \"$f\" | grep -q \"#!\"; then if [ ! -x \"$f\" ]; then echo \"$f: has shebang but is not executable (run: chmod +x $f)\"; fail=1; fi; fi; done; exit $fail' --"
language = "system"
types_or = ["bash", "shell", "python", "ruby", "perl"]
priority = 0
[[repos.hooks]]
id = "ty"
name = "ty type checker"
entry = "uv run ty check"
language = "system"
types = ["python"]
pass_filenames = false
priority = 1
[[repos.hooks]]
id = "pytest-testmon"
name = "pytest affected tests"
entry = "uv run pytest -q --testmon --no-cov"
language = "system"
types = ["python"]
pass_filenames = false
verbose = true
stages = ["pre-commit"]
priority = 1
[[repos.hooks]]
id = "pytest-cov"
name = "pytest with coverage"
entry = "uv run pytest -q --cov --cov-fail-under=90 --cov-report=term-missing:skip-covered"
language = "system"
types = ["python"]
pass_filenames = false
verbose = true
stages = ["pre-push"]
priority = 1
[[repos.hooks]]
id = "docs-build"
name = "docs build check"
entry = "bash -c 'test -f htmlcov/index.html || (mkdir -p htmlcov && touch htmlcov/index.html); uv run poe docs-build; rm -f site/objects.inv'"
language = "system"
files = { glob = ["docs/**", "zensical.toml", "README.md", "CONTRIBUTING.md", "CHANGELOG.md", "src/**"] }
pass_filenames = false
stages = ["pre-push"]
[[repos.hooks]]
id = "check-template-update"
name = "check for template updates"
entry = "bash scripts/check-template-update.sh"
language = "system"
always_run = true
pass_filenames = false
verbose = true
stages = ["post-checkout"]
[[repos]]
repo = "https://github.com/compilerla/conventional-pre-commit"
rev = "v4.4.0" # prek autoupdate will fill this
hooks = [
{ id = "conventional-pre-commit", stages = ["commit-msg"], priority = 1, args = [
"--strict",
"--verbose",
"feat",
"fix",
"perf",
"build",
"chore",
"ci",
"docs",
"style",
"refactor",
"test",
] },
]