require-valid-repository-hook-env
Require repository hook env values to be JSON objects when present.
Rule catalog ID: R065
Targeted pattern scopeâ
.github/hooks/**/*.json
What this rule reportsâ
envvalues that are arrays, numbers, strings, or other non-object JSON values
Why this rule existsâ
Hook environment variables are documented as key/value mappings. Requiring an object shape keeps that contract explicit and prevents malformed environment configuration.
â Incorrectâ
{
"version": 1,
"hooks": {
"sessionStart": [{ "type": "command", "bash": "echo ready", "env": ["LOG_LEVEL"] }]
}
}
â Correctâ
{
"version": 1,
"hooks": {
"sessionStart": [{ "type": "command", "bash": "echo ready", "env": { "LOG_LEVEL": "info" } }]
}
}