Files
rpmbuilder/.pre-commit-config.yaml
T
unkinben be23a37c2e feat: JSON Schema validation for metadata.yaml as pre-commit hook
Adds schema/metadata.json (JSON Schema draft-07) as the authoritative
schema for all rpms/*/metadata.yaml files.  Key constraints:

- additionalProperties: false at both the top level and builds items,
  so unknown fields are rejected outright
- name allows dots (fixes neovim-glibc-2.17)
- github is optional (fixes claude-code, which has no GitHub repo)
- repository enum includes fedora/42, fedora/43, fedora/44
- dist_tag boolean field documented in schema

Pre-commit hook (check-jsonschema 0.37.2) runs against every file
matching ^rpms/[^/]+/metadata\.yaml$ on every commit.

Also fixes rpms/claude-code/metadata.yaml: removes the unknown
claude_ai field and normalises field order.
2026-05-17 11:14:35 +10:00

50 lines
1.3 KiB
YAML

---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-executables-have-shebangs
- id: check-json
- id: check-added-large-files
args: ['--maxkb=500']
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-toml
- id: check-yaml
args: [--allow-multiple-documents]
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- id: detect-private-key
- id: end-of-file-fixer
- id: forbid-new-submodules
- id: pretty-format-json
- id: trailing-whitespace
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.37.1
hooks:
- id: yamllint
args:
[
"-d {extends: relaxed, rules: {line-length: disable}}",
"-s",
]
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-jsonschema
name: Validate RPM package metadata
files: ^rpms/[^/]+/metadata\.yaml$
args: [--schemafile, schema/metadata.json]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.7
hooks:
# Run the linter.
- id: ruff-check
args: [--fix]
# Run the formatter.
- id: ruff-format