require-relative-repository-hook-cwd
Require repository hook cwd values to use repository-relative paths.
Rule catalog ID: R062
Targeted pattern scopeâ
.github/hooks/**/*.json
What this rule reportsâ
- absolute or otherwise non-relative
cwdvalues in hook definitions
Why this rule existsâ
Repository hooks are meant to run against the checked-out repository. Repository-relative working directories are more portable than absolute paths and avoid machine-specific configuration.
â Incorrectâ
{
"version": 1,
"hooks": {
"sessionStart": [{ "type": "command", "bash": "echo ready", "cwd": "/tmp" }]
}
}
â Correctâ
{
"version": 1,
"hooks": {
"sessionStart": [{ "type": "command", "bash": "echo ready", "cwd": "scripts" }]
}
}