check

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker interface {
	Check(ctx context.Context, in Input) (Output, error)
	Name() string
}

Checker allows to execute check in a generic way

type FileExistChecker

type FileExistChecker struct{}

func NewFileExist

func NewFileExist() *FileExistChecker

func (FileExistChecker) Check

func (FileExistChecker) Check(ctx context.Context, in Input) (Output, error)

func (FileExistChecker) Name

func (FileExistChecker) Name() string

type Input

type Input struct {
	RepoDir          string
	CodeownerEntries []codeowners.Entry
}

type Issue

type Issue struct {
	Severity SeverityType // enum // default error
	LineNo   uint64
	Message  string
}

type Opt

type Opt func(*Issue)

func WithSeverity

func WithSeverity(s SeverityType) Opt

type Output

type Output struct {
	Issues []Issue
}

func (*Output) ReportIssue

func (out *Output) ReportIssue(e codeowners.Entry, msg string, opts ...Opt) Issue

TODO: decide where to put it

type SeverityType

type SeverityType int
const (
	Error SeverityType = iota
	Warning
)

func (SeverityType) String

func (s SeverityType) String() string

type ValidOwnerChecker

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

ValidOwnerChecker validates each owner

func NewValidOwner

func NewValidOwner(cfg ValidOwnerCheckerConfig, ghClient *github.Client) *ValidOwnerChecker

NewValidOwner returns new instance of the ValidOwnerChecker

func (*ValidOwnerChecker) Check

func (v *ValidOwnerChecker) Check(ctx context.Context, in Input) (Output, error)

Check check if defined owners are the valid ones. Allowed owner syntax: @username @org/team-name user@example.com source: https://help.github.com/articles/about-code-owners/#codeowners-syntax

Checks: - if owner is one of: github user, org team, email address - if github user then check if have github account - if github user then check if he/she is in organization - if org team then check if exists in organization

func (ValidOwnerChecker) Name

func (ValidOwnerChecker) Name() string

type ValidOwnerCheckerConfig

type ValidOwnerCheckerConfig struct {
	OrganizationName string
}

Jump to

Keyboard shortcuts

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