Documentation
¶
Overview ¶
Package codeowners reads a CODEOWNERS file the way GitHub or GitLab reads it and answers who owns a set of paths. It is pure: the caller reads the file.
Only owners a forge can be asked to review as are kept: a @username, or a team or group as @org/team, read on GitLab as GitLab's ReferenceExtractor reads them. Email owners, GitLab's @@role owners and any other shape are dropped, since nothing here can turn them into a reviewer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dialect ¶
type Dialect int
Dialect is which forge's CODEOWNERS rules a file is read by.
const ( // GitHub has one list of rules, the last match wins, and a pattern holding a // slash is anchored to the repository root. GitHub Dialect = iota // GitLab adds sections, each with its own last match and default owners, // and !pattern exclusions; a pattern repeated in a section keeps only its // later line. The lines before the first header are the section named // codeowners. A pattern matches the whole path, as GitLab's fnmatch does: // an unanchored one at any depth, and only one ending in a slash covers a // directory's contents, so docs and /docs name a file and docs/* a // directory's direct children. GitLab )
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is a parsed CODEOWNERS file. The zero File owns nothing.
type Owners ¶
Owners are the people and the teams that own some paths, each listed once in the order first seen. A team is org/team (GitLab: group/subgroup). On GitLab a top-level group is written @group, just as a user is, so a bare name is in Users and the forge resolves it to a user or, failing that, a group.