Skip to main content

no-empty-repository-hook-arrays

Disallow empty repository hook arrays that opt into an event without any hook definitions.

Rule catalog ID: R067

Targeted pattern scope​

  • .github/hooks/**/*.json

What this rule reports​

  • hook event arrays declared as []

Why this rule exists​

An empty array says the repository opted into a hook event but did not actually configure any hooks. Removing empty event entries keeps the file focused on real behavior and makes the configuration easier to read.

❌ Incorrect​

{ "version": 1, "hooks": { "sessionStart": [] } }

✅ Correct​

{ "version": 1, "hooks": {} }

or:

{
"version": 1,
"hooks": {
"sessionStart": [{ "type": "command", "bash": "echo ready" }]
}
}

Further reading​