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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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