check

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListFormatFunc added in v0.2.0

func ListFormatFunc(es []codeowners.Entry) string

ListFormatFunc is a basic formatter that outputs a bullet point list of the pattern.

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 DuplicatedPatternChecker added in v0.2.0

type DuplicatedPatternChecker struct{}

DuplicatedPatternChecker validates if CODEOWNERS file does not contain the duplicated lines with the same file pattern.

func NewDuplicatedPattern added in v0.2.0

func NewDuplicatedPattern() *DuplicatedPatternChecker

NewDuplicatedPattern returns instance of the DuplicatedPatternChecker

func (*DuplicatedPatternChecker) Check added in v0.2.0

Check searches for doubles paths(patterns) in CODEOWNERS file.

func (DuplicatedPatternChecker) Name added in v0.2.0

Name returns human readable name of the validator.

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 NotOwnedFileChecker added in v0.2.0

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

func NewNotOwnedFile added in v0.2.0

func NewNotOwnedFile(cfg NotOwnedFileCheckerConfig) *NotOwnedFileChecker

func (*NotOwnedFileChecker) AppendToGitignoreFile added in v0.2.0

func (c *NotOwnedFileChecker) AppendToGitignoreFile(repoDir string, patterns []string) error

func (*NotOwnedFileChecker) Check added in v0.2.0

func (c *NotOwnedFileChecker) Check(ctx context.Context, in Input) (output Output, err error)

func (*NotOwnedFileChecker) GitCheckStatus added in v0.2.0

func (c *NotOwnedFileChecker) GitCheckStatus(repoDir string) error

func (*NotOwnedFileChecker) GitListFiles added in v0.2.0

func (c *NotOwnedFileChecker) GitListFiles(repoDir string) (string, error)

func (*NotOwnedFileChecker) GitRemoveIgnoredFiles added in v0.2.0

func (c *NotOwnedFileChecker) GitRemoveIgnoredFiles(repoDir string) error

func (*NotOwnedFileChecker) GitResetCurrentBranch added in v0.2.0

func (c *NotOwnedFileChecker) GitResetCurrentBranch(repoDir string) error

func (*NotOwnedFileChecker) ListFormatFunc added in v0.2.0

func (c *NotOwnedFileChecker) ListFormatFunc(es []string) string

ListFormatFunc is a basic formatter that outputs a bullet point list of the pattern.

func (NotOwnedFileChecker) Name added in v0.2.0

func (NotOwnedFileChecker) Name() string

Name returns human readable name of the validator

type NotOwnedFileCheckerConfig added in v0.2.0

type NotOwnedFileCheckerConfig struct {
	SkipPatterns []string `envconfig:"optional"`
}

type Opt

type Opt func(*Issue)

func WithEntry added in v0.2.0

func WithEntry(e codeowners.Entry) Opt

func WithSeverity

func WithSeverity(s SeverityType) Opt

type Output

type Output struct {
	Issues []Issue
}

func (*Output) ReportIssue

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

type SeverityType

type SeverityType int
const (
	Error SeverityType = iota + 1
	Warning
)

func (SeverityType) String

func (s SeverityType) String() string

func (*SeverityType) Unmarshal added in v0.2.0

func (s *SeverityType) Unmarshal(in string) error

Unmarshal provides custom parsing of severity type. Implements envconfig.Unmarshal interface.

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

Name returns human readable name of the validator

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