| layout | default |
|---|---|
| title | Pre-commit Hooks |
| parent | Home |
| nav_order | 3 |
This repository provides reusable pre-commit hooks for NHS Notify projects.
Sorts dictionary files alphabetically to maintain consistency.
Usage:
- repo: https://github.com/NHSDigital/nhs-notify-shared-modules
rev: vX.Y.Z
hooks:
- id: sort-dictionaryScans the entire Git history for secrets and sensitive information.
Usage:
- repo: https://github.com/NHSDigital/nhs-notify-shared-modules
rev: vX.Y.Z
hooks:
- id: scan-secretsValidates file formatting standards across the repository.
Usage:
- repo: https://github.com/NHSDigital/nhs-notify-shared-modules
rev: vX.Y.Z
hooks:
- id: check-file-formatChecks Markdown files for formatting issues using markdownlint.
Usage:
- repo: https://github.com/NHSDigital/nhs-notify-shared-modules
rev: vX.Y.Z
hooks:
- id: check-markdown-formatValidates English usage and style using Vale.
Usage:
- repo: https://github.com/NHSDigital/nhs-notify-shared-modules
rev: vX.Y.Z
hooks:
- id: check-english-usageLints and formats Terraform code using terraform fmt.
Usage:
- repo: https://github.com/NHSDigital/nhs-notify-shared-modules
rev: vX.Y.Z
hooks:
- id: lint-terraformGenerates and validates Terraform module documentation.
Usage:
- repo: https://github.com/NHSDigital/nhs-notify-shared-modules
rev: vX.Y.Z
hooks:
- id: generate-terraform-docsValidates TODO comments follow the required format with Jira ticket IDs.
Usage:
- repo: https://github.com/NHSDigital/nhs-notify-shared-modules
rev: vX.Y.Z
hooks:
- id: check-todo-usageRuns the same SBOM and Grype dependency scan used in CI and prints the markdown vulnerability summary locally.
Usage:
- repo: https://github.com/NHSDigital/nhs-notify-shared-modules
rev: vX.Y.Z
hooks:
- id: scan-dependenciesRun it manually when needed:
pre-commit run --config scripts/config/pre-commit.yaml --hook-stage manual scan-dependenciesAdd to your .pre-commit-config.yaml:
repos:
- repo: https://github.com/NHSDigital/nhs-notify-shared-modules
rev: vX.Y.Z # Use the latest release tag
hooks:
- id: scan-secrets
- id: check-file-format
- id: check-markdown-format
- id: lint-terraform
- id: scan-dependencies
# Add other hooks as neededThen install:
pre-commit install- All hooks run with
pass_filenames: false- they operate on the entire repository - The
scan-secretshook checks the entire Git history for security - Hooks reference scripts in either
scripts/githooks/or.github/actions/ scan-dependenciesuses the same Grype-based workflow as CI, respectsscripts/config/grype.yamlwhen present, and is configured as a manual-only hook