I'm trying to set up a mirror for @bugron/validate-dependabot-yaml. I'm running:
$ pre-commit-mirror . \
--language node \
--package-name '@bugron/validate-dependabot-yaml' \
--id validate-dependabot-cli \
--entry validate-dependabot-yaml \
--files-regex '^(\.github|config)/dependabot\.ya?ml$'
The produced YAML file ends up with name: @bugron/validate-dependabot-yaml (no quotes). The problem is @ (as the first character) is one of YAML's reserved indicators so this produces invalid YAML and the hook can't load.
One fix is to change name: {name} in the all/.pre-commit-hooks.yaml to name: {name!r}. This is what we do for description.
Another is to use pyyaml to dump the file instead of string formatting, but it's more involvd.
With either fix I verified that the same pre-commit-mirror command produces a valid .pre-commit-hooks.yaml file with name: '@bugron/validate-dependabot-yaml' (with quotes) and I verified that the repo runs with pre-commit try-repo.
I'm trying to set up a mirror for
@bugron/validate-dependabot-yaml. I'm running:The produced YAML file ends up with
name: @bugron/validate-dependabot-yaml(no quotes). The problem is@(as the first character) is one of YAML's reserved indicators so this produces invalid YAML and the hook can't load.One fix is to change
name: {name}in theall/.pre-commit-hooks.yamltoname: {name!r}. This is what we do fordescription.Another is to use
pyyamlto dump the file instead of string formatting, but it's more involvd.With either fix I verified that the same
pre-commit-mirrorcommand produces a valid.pre-commit-hooks.yamlfile withname: '@bugron/validate-dependabot-yaml'(with quotes) and I verified that the repo runs withpre-commit try-repo.