When you commit changes, the pre-commit framework reads .pre-commit-config.yaml
at the repo root, selects hooks whose files: regex matches the staged set,
and runs them in declaration order. The sequence below matches the current
config exactly. Each hook only runs when its trigger files are staged; unused
hooks show (no files to check) Skipped in the output.
- Schema Validation — one
check-jsonschemahook per yaml/schema pair (9 pairs: actor-access, components, controls, frameworks, impact-type, lifecycle-stage, mermaid-styles, personas, risks), plus a dedicated hook for the archived legacy self-assessment pair underrisk-map/(yaml|schemas)/archive/(per ADR-021 D6). - Schema Meta-Validation —
check-metaschemavalidates eachrisk-map/schemas/*.schema.jsonis itself a structurally valid JSON Schema against its declared$schemametaschema. - Schema Master Trigger — when
risk-map/schemas/riskmap.schema.jsonitself is staged, every yaml is re-validated against its schema. - Prettier Formatting —
prettier-yamlwrapper formats yamls underrisk-map/yaml/andgit adds the reformatted output (Mode B auto-stage). - Ruff Lint —
ruffchecks staged Python files. - Ruff Format —
ruff-formatformats staged Python files. - Component Edge Validation —
validate_riskmap.pyruns whencomponents.yamlis staged. - Control-to-Risk Reference Validation —
validate_control_risk_references.pyruns whencontrols.yamlorrisks.yamlis staged. - Framework Reference Validation —
validate_framework_references.pyruns whencontrols,frameworks,personas, orrisksyaml is staged. - GitHub Actions
uses:Pinning Validation —validate_workflow_uses_pinning.pyruns when.github/workflows/*.ymlor nested workflow.ymlfiles are staged. - Issue Template Regeneration —
regenerate_issue_templates.pyruns when any template source, any schema, orframeworks.yamlis staged; generates.github/ISSUE_TEMPLATE/*.ymland stages them. - Issue Template Validation —
validate_issue_templates.pyruns when anything under.github/ISSUE_TEMPLATE/orscripts/TEMPLATES/is staged (including the files just regenerated in step 11). - Graph Regeneration —
regenerate_graphs.pyproduces risk-map graph, controls graph, and controls-to-risk graph (3 markdown + 3 mermaid outputs) based on which ofcomponents.yaml,controls.yaml,risks.yamlis staged. Each output pair isgit add-ed on success. - Table Regeneration —
regenerate_tables.pyregenerates 8 table outputs across 4 triggers (seescripts/docs/table-generation.md). - SVG Regeneration —
regenerate_svgs.pyconverts stagedrisk-map/diagrams/*.mmdor*.mermaidfiles to SVG.
The commit is blocked if any hook returns non-zero.
# Against the working tree (does NOT require staged files):
pre-commit run --all-files
# Against only staged files (same as what git commit does):
pre-commit runNote: pre-commit run --all-files will also run the generators, which may
modify derivatives in your working tree. To validate without regeneration,
use scripts/tools/validate-all.sh (see Manual Validation).
Related:
- Hook Validations — Details of each hook
- Manual Validation — Running validators without committing
- Troubleshooting — Handling validation failures