Help us shape the future of Go! Take the 2026 Go Developer Survey

codeowners

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeduplicateReviewers

func DeduplicateReviewers(reviewers []string) []string

DeduplicateReviewers removes duplicate reviewers from a list

func FilterCurrentUser

func FilterCurrentUser(reviewers []string, currentUser string) []string

FilterCurrentUser removes the current user from the reviewers list

func FindCodeownersFile

func FindCodeownersFile(repoPath string) (string, error)

FindCodeownersFile searches for CODEOWNERS file in standard locations

func GetChangedFiles

func GetChangedFiles(repo *git.Repository, baseBranch, headBranch string) ([]string, error)

GetChangedFiles returns the list of files changed between base and head

func GetStackAwareReviewers

func GetStackAwareReviewers(repo *git.Repository, co *CodeOwners, currentBranch, baseBranch, trunkBranch, currentUser string, considerFullStack bool) ([]string, error)

GetStackAwareReviewers returns reviewers considering the entire stack or just current PR When considerFullStack is true, it suggests reviewers for all files changed in the stack When false, it only considers files changed in the current PR

func HasCodeowners

func HasCodeowners(repoPath string) bool

HasCodeowners checks if a CODEOWNERS file exists

func ValidateOwner

func ValidateOwner(owner string) bool

ValidateOwner checks if an owner string is valid

Types

type CodeOwners

type CodeOwners struct {
	Rules []Rule
	Path  string // Path to CODEOWNERS file
}

CodeOwners represents a parsed CODEOWNERS file

func ParseCodeowners

func ParseCodeowners(repoPath string) (*CodeOwners, error)

ParseCodeowners reads and parses a CODEOWNERS file

func (*CodeOwners) GetOwnersForFile

func (co *CodeOwners) GetOwnersForFile(filePath string) []Owner

GetOwnersForFile returns the owners for a specific file

func (*CodeOwners) GetReviewers

func (co *CodeOwners) GetReviewers(changedFiles []string, currentUser string) []string

GetReviewers returns suggested reviewers for the given changed files

type Owner

type Owner struct {
	Name string // @username or @org/team
	Type string // "user" or "team"
}

Owner represents a code owner (user or team)

type Rule

type Rule struct {
	Pattern string  // File pattern (glob)
	Owners  []Owner // List of owners for this pattern
	Line    int     // Line number in CODEOWNERS file (for debugging)
}

Rule represents a CODEOWNERS rule mapping a pattern to owners

Jump to

Keyboard shortcuts

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