require-codeowners-file
Require a CODEOWNERS file for deterministic review ownership.
Targeted pattern scopeâ
This rule checks for a CODEOWNERS file in any accepted location:
CODEOWNERS.github/CODEOWNERS.gitlab/CODEOWNERS.bitbucket/CODEOWNERSdocs/CODEOWNERS
What this rule reportsâ
This rule reports repositories that do not define code ownership anywhere in the accepted locations.
Why this rule existsâ
When ownership is implicit, review routing becomes tribal knowledge.
CODEOWNERS gives teams a stable, automatable mapping between files and the
people or groups responsible for reviewing them.
â Incorrectâ
// Repository files
// .
// âââ README.md
// âââ SECURITY.md
// âââ .github/
// âââ workflows/
//
// Missing: CODEOWNERS in root, .github/, .gitlab/, .bitbucket/, or docs/
â Correctâ
// Repository files
// .
// âââ CODEOWNERS
// âââ README.md
// âââ .github/
// Repository files
// .
// âââ README.md
// âââ .github/
// âââ CODEOWNERS
// Repository files
// .
// âââ README.md
// âââ .gitlab/
// âââ CODEOWNERS
// Repository files
// .
// âââ README.md
// âââ .bitbucket/
// âââ CODEOWNERS
ESLint flat config exampleâ
import repoPlugin from "eslint-plugin-repo";
export default [
repoPlugin.configs.strict,
{
plugins: { "repo-compliance": repoPlugin },
rules: {
"repo-compliance/require-codeowners-file": "error",
},
},
];
When not to use itâ
Disable this rule only if your review ownership model is intentionally manual or
managed through a platform feature that does not rely on CODEOWNERS.
Rule catalog ID: R007