From 9872c01a04115e19ee813897cf5bd77eb48361ee Mon Sep 17 00:00:00 2001 From: Kevin Broch Date: Wed, 20 Nov 2024 13:10:06 -0800 Subject: [PATCH] add json related pre-commit hooks relates to #260 and #267 --- .pre-commit-config.yaml | 48 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..3bee6415a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,48 @@ +--- +exclude: ^docs/ruby/ + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-symlinks + - id: end-of-file-fixer + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + - id: check-json + exclude: ^\.devcontainer/ # Uses JSONC (comments) + + - repo: https://github.com/rbubley/mirrors-prettier + rev: v3.3.3 + hooks: + - id: prettier + files: \.json$ + + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.29.4 + hooks: + - id: check-jsonschema + alias: check-jsonschema-inst + files: ^arch/inst/.*\.(yaml|yml)$ + args: ["--schemafile", "schemas/inst_schema.json"] + - id: check-jsonschema + alias: check-jsonschema-csr + files: ^arch/csr/.*\.(yaml|yml)$ + args: ["--schemafile", "schemas/csr_schema.json"] + - id: check-jsonschema + alias: check-jsonschema-ext + files: ^arch/ext/.*\.(yaml|yml)$ + args: ["--schemafile", "schemas/ext_schema.json"] + - id: check-jsonschema + alias: check-jsonschema-cert-model + files: ^arch/certificate_model/.*\.(yaml|yml)$ + args: ["--schemafile", "schemas/cert_model_schema.json"] + - id: check-jsonschema + alias: check-jsonschema-cert-class + files: ^arch/certificate_class/.*\.(yaml|yml)$ + args: ["--schemafile", "schemas/cert_class_schema.json"] + # Commenting because throwing errors and not sure this is complete yet + # - id: check-jsonschema + # alias: check-jsonschema-manual-version + # files: ^arch/manual/.*\.(yaml|yml)$ + # args: ["--schemafile", "schemas/manual_version_schema.json"]