check

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2020 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 DuplicatedPattern added in v0.3.0

type DuplicatedPattern struct{}

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

func NewDuplicatedPattern added in v0.2.0

func NewDuplicatedPattern() *DuplicatedPattern

NewDuplicatedPattern returns instance of the DuplicatedPattern

func (*DuplicatedPattern) Check added in v0.3.0

func (d *DuplicatedPattern) Check(ctx context.Context, in Input) (Output, error)

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

func (DuplicatedPattern) Name added in v0.3.0

func (DuplicatedPattern) Name() string

Name returns human readable name of the validator.

type FileExist added in v0.3.0

type FileExist struct{}

func NewFileExist

func NewFileExist() *FileExist

func (FileExist) Check added in v0.3.0

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

func (FileExist) Name added in v0.3.0

func (FileExist) 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 NotOwnedFile added in v0.3.0

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

func NewNotOwnedFile added in v0.2.0

func NewNotOwnedFile(cfg NotOwnedFileConfig) *NotOwnedFile

func (*NotOwnedFile) AppendToGitignoreFile added in v0.3.0

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

func (*NotOwnedFile) Check added in v0.3.0

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

func (*NotOwnedFile) GitCheckStatus added in v0.3.0

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

func (*NotOwnedFile) GitListFiles added in v0.3.0

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

func (*NotOwnedFile) GitRemoveIgnoredFiles added in v0.3.0

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

func (*NotOwnedFile) GitResetCurrentBranch added in v0.3.0

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

func (*NotOwnedFile) ListFormatFunc added in v0.3.0

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

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

func (NotOwnedFile) Name added in v0.3.0

func (NotOwnedFile) Name() string

Name returns human readable name of the validator

type NotOwnedFileConfig added in v0.3.0

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

type Output

type Output struct {
	Issues []Issue
}

func (*Output) ReportIssue

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

type ReportIssueOpt added in v0.3.0

type ReportIssueOpt func(*Issue)

func WithEntry added in v0.2.0

func WithEntry(e codeowners.Entry) ReportIssueOpt

func WithSeverity

func WithSeverity(s SeverityType) ReportIssueOpt

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 ValidOwner added in v0.3.0

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

ValidOwner validates each owner

func NewValidOwner

func NewValidOwner(cfg ValidOwnerConfig, ghClient *github.Client) (*ValidOwner, error)

NewValidOwner returns new instance of the ValidOwner

func (*ValidOwner) Check added in v0.3.0

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

Check checks 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 (ValidOwner) Name added in v0.3.0

func (ValidOwner) Name() string

Name returns human readable name of the validator

type ValidOwnerConfig added in v0.3.0

type ValidOwnerConfig struct {
	Repository string
}

Jump to

Keyboard shortcuts

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