Skip to content

SYSTEM Cited by 1 source

pre-commit

Definition

pre-commit (pre-commit.com) is a framework for managing multi-language git pre-commit hooks. The configuration lives in .pre-commit-config.yaml in the repository root; the pre-commit binary installs the declared hooks into .git/hooks/pre-commit and runs them against staged files on each commit. Hooks can be built-ins (trailing-whitespace, end-of-file-fixer, check-added-large-files, mixed-line-ending), third-party from git repos (pre-commit-hooks, language-specific linters), or repo: local hooks that invoke an arbitrary script in the repo.

Seen in

  • — used to lint the engineering blog's content. A repo: local hook invokes poetry run ./validate-content.py against markdown files (excluding pages). The Python validator enforces: (1) required frontmatter keys, (2) year/month folder placement, (3) article tags from an explicit allowlist. Standard hooks also enforce trailing whitespace, EOF fixing, and large-file guard. make lint runs the same hooks in Zalando's CD platform pipeline so the checks re-run server-side.
  • sources/2024-01-22-zalando-tale-of-metadpata-the-revenge-of-the-supertools — second Zalando appearance: pre-commit hooks as the commit-time enforcement point of Zalando's triple- redundant jsonschema validation stack (IDE + pre-commit + CI), introduced post-metadpata incident alongside systems/cfn-lint for CloudFormation template linting. Same schema file runs at all three points to avoid drift. See patterns/jsonschema-validated-config-both-local-and-ci.
Last updated · 542 distilled / 1,571 read