restincode/.pre-commit-config.yaml
mauvehed 657082e940
ci: validate memorial json against schema and site conventions
Add schema/person.schema.json and scripts/validate_people.py, run via a
pre-commit hook and a GitHub Actions job on pull requests. Checks:

- people/*.json match the schema (keys, types, item shapes)
- every peoplelist.json entry has a file and every file is listed once
- filenames are lowercase alphanumeric (two legacy names grandfathered)
- local image paths exist under images/
- link fields are http(s) with no surrounding whitespace
- text-only fields contain no HTML; maintext stays raw HTML by design

Warns (non-fatal) on gallery items with no title, which the page uses as
alt text. Adds a pip dependabot entry for scripts/requirements.txt.
2026-09-05 10:25:02 -05:00

26 lines
998 B
YAML

# .pre-commit-config.yaml
exclude: '(CNAME|Gemfile|\..*\.y[a]?ml)'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0 # use `pre-commit autoupdate` to get the latest rev
hooks:
- id: no-commit-to-branch
args: ['--branch', 'main'] # prevent local commits to main branch
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types_or: [json, html, css, javascript, yaml, markdown]
- repo: local
hooks:
- id: validate-people
name: validate memorial data
entry: python scripts/validate_people.py
language: python
additional_dependencies: [jsonschema==4.26.0]
pass_filenames: false
files: ^(people/.*\.json|peoplelist\.json|images/.*|schema/.*|scripts/validate_people\.py)$
ci:
autofix_prs: true # set false to stop pull-request commits being added by pre-commit.ci