codeowners

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	LineNo  uint64
	Pattern string
	Owners  []string
}

Entry contains owners for a given pattern

func NewFromPath

func NewFromPath(repoPath string) ([]Entry, error)

NewFromPath returns entries from codeowners

Example
package main

import (
	"fmt"

	"github.com/mszostok/codeowners-validator/pkg/codeowners"
)

func main() {
	pathToCodeownersFile := "./testdata/"

	entries, err := codeowners.NewFromPath(pathToCodeownersFile)
	if err != nil {
		panic(err)
	}

	for _, e := range entries {
		fmt.Printf("[line] %d: [pattern]: %s [owners]: %v\n", e.LineNo, e.Pattern, e.Owners)
	}

}
Output:

[line] 8: [pattern]: * [owners]: [@global-owner1 @global-owner2]
[line] 14: [pattern]: *.js [owners]: [@js-owner]
[line] 19: [pattern]: *.go [owners]: [docs@example.com]
[line] 24: [pattern]: /build/logs/ [owners]: [@doctocat]
[line] 29: [pattern]: docs/* [owners]: [docs@example.com]
[line] 33: [pattern]: apps/ [owners]: [@octocat]
[line] 37: [pattern]: /docs/ [owners]: [@doctocat]

func ParseCodeowners added in v0.6.0

func ParseCodeowners(r io.Reader) []Entry

func (Entry) String

func (e Entry) String() string

Jump to

Keyboard shortcuts

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