codeowners

package module
v0.0.0-...-472b8ae Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

README

codeowners

Run inside a git repo with a CODEOWNERS file. Reads files from stdin and groups by first found codeowner. Useful for working inside a git monorepo.

Example

git diff --name-only | co

Documentation

Index

Constants

View Source
const CODEOWNERS_FILE = "CODEOWNERS"

Variables

View Source
var (
	ErrNotGitRepo   = errors.New("not in a git repo")
	ErrNoCodeOwners = errors.New("no codeowners file found")
)

Functions

This section is empty.

Types

type CodeOwners

type CodeOwners []Matcher

func (CodeOwners) Match

func (co CodeOwners) Match(input, repoRoot string) (Owner, error)

type ErrInvalidLine

type ErrInvalidLine struct {
	Message string
	Line    int
}

func (ErrInvalidLine) Error

func (e ErrInvalidLine) Error() string

type ErrPatternParse

type ErrPatternParse struct {
	Input string
	Err   error
	Line  int
}

func (ErrPatternParse) Error

func (e ErrPatternParse) Error() string

type Matcher

type Matcher struct {
	Owners []Owner
	// contains filtered or unexported fields
}

func ParseOwnerLine

func ParseOwnerLine(ln int, line string) (Matcher, error)

func (Matcher) Match

func (m Matcher) Match(fp string) []Owner

type Owner

type Owner string
const NOT_IN_REPO Owner = "tarnished"
const NO_OWNER Owner = "maidenless"

type ParsedCodeOwners

type ParsedCodeOwners struct {
	CodeOwners CodeOwners
	Warnings   []error
}

type Pattern

type Pattern struct {
	// contains filtered or unexported fields
}

func NewPattern

func NewPattern(s string) (Pattern, error)

func (Pattern) Match

func (p Pattern) Match(b []byte) bool

func (Pattern) String

func (p Pattern) String() string

type RepoInfo

type RepoInfo struct {
	GitRoot    string
	Codeowners string
}

func GetRepoInformation

func GetRepoInformation(cwd string) (RepoInfo, error)

func (RepoInfo) ParseCodeOwners

func (ri RepoInfo) ParseCodeOwners() (ParsedCodeOwners, error)

Directories

Path Synopsis
cmd
co command

Jump to

Keyboard shortcuts

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