codeowners

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package codeowners parses and resolves CODEOWNERS path rules without applying any reviewer-ranking policy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Match

type Match struct {
	Pattern string
	Line    int
	Owners  []Owner
}

Match is the last rule that matched one repository-relative file path.

func Resolve

func Resolve(rules []Rule, path string) (Match, bool)

Resolve returns the owners from the last matching rule. Paths are matched case-sensitively and are interpreted relative to the repository root.

type Owner

type Owner struct {
	Token string
	Type  OwnerType
	Name  string
}

Owner preserves one source token exactly while exposing its syntactic kind and normalized lookup name.

type OwnerType

type OwnerType string

OwnerType is the syntactic identity kind carried by an owner token.

const (
	OwnerUser      OwnerType = "user"
	OwnerTeam      OwnerType = "team"
	OwnerEmail     OwnerType = "email"
	OwnerMalformed OwnerType = "malformed"
)

type Rule

type Rule struct {
	Pattern string
	Line    int
	Owners  []Owner
	// contains filtered or unexported fields
}

Rule is one valid CODEOWNERS rule. Pattern is the source spelling, including escapes; Line is one-based.

func Parse

func Parse(source string) []Rule

Parse applies the CODEOWNERS subset of gitignore syntax. Invalid pattern lines are skipped, while malformed owner tokens on a valid rule are kept as explicit OwnerMalformed facts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL