hooks/shared-hygiene
Hooks include the shared hygiene checks
| Severity | warning |
| Tiers | 1, 2 |
| Stacks | any |
| Scope | root |
| Kind | expr |
| Source | library v0.5.0 |
| Selected by | fleetlint-recommended@v0.5.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 of this rule points at .pre-commit-config.yaml.
Sources
- https://fleetlint.org/baseline/#git-hooks (convention)
- https://github.com/pre-commit/pre-commit-hooks (spec)
Generated by fleetlint docs from catalog v0.5.0.