fleetlint Policy for a fleet of repositories
v0.7
Getting started

hooks/revs-pinned

Hook repositories are pinned to versions

Severitywarning
Tiers1, 2
Stacksany
Scoperoot
Kindexpr
Sourcelibrary v0.4.0
Selected byfleetlint-recommended@v0.4.0

Requirement

Every rev: in .pre-commit-config.yaml is a version tag or a commit SHA, never a branch name (main, master, HEAD, develop, trunk, latest, stable, 2.x); a rev without a digit is taken for a branch.

Why

A hook at a branch runs whatever was pushed there last, on every developer’s machine, before anything is reviewed.

Applies when

file(".pre-commit-config.yaml") && type(yaml(".pre-commit-config.yaml")) == map && "repos" in yaml(".pre-commit-config.yaml") && type(yaml(".pre-commit-config.yaml").repos) == list

Check

For each item in:

yaml(".pre-commit-config.yaml").repos.filter(r, type(r) == map && "rev" in r).map(r, {
  "path": ".pre-commit-config.yaml",
  "name": ("repo" in r ? string(r.repo) : "?") + "@" + string(r.rev),
  "rev": string(r.rev)
})
item.rev.matches("^[0-9a-f]{40}$") || (item.rev.matches("[0-9]") && !item.rev.matches("(?i)(^|[-/])(main|master|head|develop|dev|trunk|latest|stable|nightly|next)$|\\.x$"))

Fix

Run prek update (pre-commit: pre-commit autoupdate) to replace branch revs with the latest tags.

Agent instruction: Replace each flagged rev with the repository’s latest release tag (prek update does this); do not change hooks or args.

Sources


Generated by fleetlint docs from catalog v0.4.0.