fleetlint Policy for a fleet of repositories
v0.11 (latest)
Getting started

hooks/shared-hygiene

Hooks include the shared hygiene checks

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

Requirement

A .pre-commit-config.yaml runs the hygiene hooks trailing-whitespace, end-of-file-fixer, check-merge-conflict and check-added-large-files, from prek’s builtin repo or pre-commit-hooks. Lefthook configurations are not checked.

Why

These catch the accidents no linter looks for, and the fixes are automatic.

Applies when

file(".pre-commit-config.yaml")

Check

type(yaml(".pre-commit-config.yaml")) == map && "repos" in yaml(".pre-commit-config.yaml") && ["trailing-whitespace", "end-of-file-fixer", "check-merge-conflict", "check-added-large-files"].all(id,
  yaml(".pre-commit-config.yaml").repos.exists(r, type(r) == map && "repo" in r
    && (r.repo == "builtin" || string(r.repo).contains("pre-commit-hooks"))
    && "hooks" in r && type(r.hooks) == list && r.hooks.exists(h, type(h) == map && "id" in h && h.id == id)))

Fix

Add the four hooks to a repo: builtin block (prek) or the https://github.com/pre-commit/pre-commit-hooks repo.

Agent instruction: Add trailing-whitespace, end-of-file-fixer, check-merge-conflict and check-added-large-files to the repo: builtin block of .pre-commit-config.yaml (or pre-commit/pre-commit-hooks for plain pre-commit).

A finding that names no file points at .pre-commit-config.yaml.

Sources


Generated by fleetlint docs from catalog v0.8.0.