Closed
Description
Similar to #516 and with a similar workaround I can't update to the newest (0.31.0
) check-jsonschema
via pre-commit due to this regression in renovate.
Example renovate.json
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"customManagers": [
{
"description": "Update rust toolchain declarations of dtolnay/rust-toolchain",
"customType": "regex",
"fileMatch": [
"\\.github/(?:workflows|actions)/.+\\.ya?ml$",
"(^|/)action\\.ya?ml$"
],
"matchStrings": [
"# renovate: rust-toolchain\\s*toolchain\\:\\s*(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)"
],
"depNameTemplate": "rust",
"packageNameTemplate": "rust-lang/rust",
"datasourceTemplate": "github-tags"
}
]
}
Verification that its fixed with nonunicode
$ check-jsonschema --version
check-jsonschema, version 0.31.0
$ check-jsonschema --builtin-schema renovate renovate.json
Schema validation errors were encountered.
renovate.json::$.customManagers[0].matchStrings[0]: '# renovate: rust-toolchain\\s*toolchain\\:\\s*(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)' is not a 'regex'
$ check-jsonschema --builtin-schema renovate --regex-variant nonunicode renovate.json
ok -- validation done
Environment Details
- MacOS Sequoia
- Bash + Python3.12
(Though I don't think the environment matters in this case)
Activity
sirosen commentedon Jan 25, 2025
Thanks for filling this!
I'm starting to regret not doing more research before choosing Unicode mode as the default. With these issues cropping up, I'm doubting that decision a bit.
To keep churn in the project to a minimum, I'll most likely mark the renovate hook as nonunicode in the next release (possibly today, if I can get some time).
I want to look at why that pattern fails though -- it's not obvious to me why the Unicode mode regex engine fails it. Maybe something about the capture group?
sirosen commentedon Jan 25, 2025
I just checked using my browser and the issue with that regex is that there's an improper escape,
\:
.Nonunicode mode will, indeed, accept that expression because it is less strict.
This might be evidence of the 0.31.0 update catching a (trivial) mistake in your usage? But if the regex works in renovate then they're probably not evaluating regexes in Unicode mode. So I think that (since renovate is implemented in JS), I'll proceed with the change in hook config, to try to match their implementation.
Callek commentedon Jan 25, 2025
Good catch, but i agree with your planned outcome anyway.
Update gitlab and renovate hooks to 'nonunicode'
Update gitlab and renovate hooks to 'nonunicode' (#519)