Closed paddyroddy closed 9 months ago
I believe that this is supported today by taking the renovate schema and running it explicitly against the file.
e.g. In pre-commit
config:
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.0
hooks:
- id: check-renovate-default
name: Validate default.json Renovate Config
description: 'Validate Renovate config in default.json'
entry: check-jsonschema --builtin-schema vendor.renovate
files: ^default\.json$
You can also run it manually with
check-jsonschema --builtin-schema vendor.renovate default.json
(The pre-commit config I showed is just the config for running this exact command with some nice description.)
I don't see any clear way to support the default.json
name out of the box -- it's not a renovate-specific filename outside of the broader context that if you already know that it's a renovate config, it's the recommended name.
Does that satisfy your needs? If not, I'll need more info about the context to understand.
Yes, that would work nicely!
I've closed this as solved. If it comes up again, I'll consider adding an FAQ doc or similar.
Thanks for stopping by with your question; it helps build the knowledge base!
Just to check (might have missed something obvious), I can see how that can go into .pre-commit-hooks.yaml
, is there a way I can - as a user - use that in my .pre-commit-config.yaml
?
That config should be valid for pre-commit-config.
The hooks config looks very similar, so I can understand the confusion. If I've made a mistake such that it's not valid for the user config file, let me know and we can fix it, but it looks right to me (from a mobile device, so I can't test it at the moment).
Think it was just a case of changing the id
to match the existing one
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.0
hooks:
- id: check-renovate
name: Validate default.json Renovate Config
description: 'Validate Renovate config in default.json'
entry: check-jsonschema --builtin-schema vendor.renovate
files: ^default\.json$
If you have a shareable preset then
renovate
recommends having it in a repo calledrenovate-config
and have the file in there calleddefault.json
, i.e. https://github.com/paddyroddy/renovate-config/blob/main/default.json. I would like to validate that thisdefault.json
is valid, but currently it would be skipped.