Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AvoidShadowing ¶ added in v0.8.0
type AvoidShadowing struct{}
func NewAvoidShadowing ¶ added in v0.8.0
func NewAvoidShadowing() *AvoidShadowing
func (AvoidShadowing) Name ¶ added in v0.8.0
func (AvoidShadowing) Name() string
Name returns human readable name of the validator
type DuplicatedPattern ¶ added in v0.8.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.8.0
Check searches for doubles paths(patterns) in CODEOWNERS file.
func (DuplicatedPattern) Name ¶ added in v0.8.0
func (DuplicatedPattern) Name() string
Name returns human readable name of the validator.
type FileExist ¶ added in v0.8.0
type FileExist struct{}
func NewFileExist ¶
func NewFileExist() *FileExist
type Issue ¶
type Issue struct {
Severity SeverityType // enum // default error
LineNo *uint64
Message string
}
type NotOwnedFile ¶ added in v0.8.0
type NotOwnedFile struct {
// contains filtered or unexported fields
}
func NewNotOwnedFile ¶ added in v0.2.0
func NewNotOwnedFile(cfg NotOwnedFileConfig) *NotOwnedFile
func (*NotOwnedFile) ListFormatFunc ¶ added in v0.8.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.8.0
func (NotOwnedFile) Name() string
Name returns human-readable name of the validator
type NotOwnedFileConfig ¶ added in v0.8.0
type OutputBuilder ¶ added in v0.8.0
type OutputBuilder struct {
// contains filtered or unexported fields
}
func (*OutputBuilder) Output ¶ added in v0.8.0
func (bldr *OutputBuilder) Output() Output
func (*OutputBuilder) ReportIssue ¶ added in v0.8.0
func (bldr *OutputBuilder) ReportIssue(msg string, opts ...ReportIssueOpt) *OutputBuilder
type ReportIssueOpt ¶ added in v0.8.0
type ReportIssueOpt func(*Issue)
func WithEntry ¶ added in v0.2.0
func WithEntry(e codeowners.Entry) ReportIssueOpt
func WithLineNo ¶ added in v0.9.0
func WithLineNo(line uint64) ReportIssueOpt
WithLineNo sets the line in the CODEOWNERS file that the issue refers to.
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.8.0
type ValidOwner struct {
// contains filtered or unexported fields
}
ValidOwner validates the owners defined in the CODEOWNERS file.
GitHub resolves CODEOWNERS owners when it requests reviews, so the check reports the errors that GitHub itself finds in the CODEOWNERS file at the validated ref. This covers owners that don't exist, have no access to the repository, are teams from another organization, and so on.
func NewValidOwner ¶
func NewValidOwner(cfg ValidOwnerConfig, ghClient *github.Client) (*ValidOwner, error)
NewValidOwner returns new instance of the ValidOwner
func (*ValidOwner) Check ¶ added in v0.8.0
Check reports the CODEOWNERS errors that GitHub identifies for the validated repository.
func (ValidOwner) Name ¶ added in v0.8.0
func (ValidOwner) Name() string
Name returns human-readable name of the validator
type ValidOwnerConfig ¶ added in v0.8.0
type ValidOwnerConfig struct {
// Repository represents the GitHub repository whose CODEOWNERS file is validated.
// It is in form 'owner/repository'.
Repository string
// Ref is a branch, tag or commit SHA that determines which version of the CODEOWNERS
// file is validated. Defaults to the commit checked out in the validated repository.
// If the validated directory isn't a Git repository, the repository's default branch is used.
Ref string `envconfig:"optional"`
// IgnoredOwners contains a list of owners that should not be validated.
// Defaults to @ghost.
// More info about the @ghost user: https://docs.github.com/en/free-pro-team@latest/github/setting-up-and-managing-your-github-user-account/deleting-your-user-account
// Tip on how @ghost can be used: https://github.community/t5/How-to-use-Git-and-GitHub/CODEOWNERS-file-with-a-NOT-file-type-condition/m-p/31013/highlight/true#M8523
IgnoredOwners []string `envconfig:"default=@ghost"`
// AllowUnownedPatterns specifies whether CODEOWNERS may have unowned files. For example:
//
// /infra/oncall-rotator/ @sre-team
// /infra/oncall-rotator/oncall-config.yml
//
// The `/infra/oncall-rotator/oncall-config.yml` this file is not owned by anyone.
AllowUnownedPatterns bool `envconfig:"default=true"`
// OwnersMustBeTeams specifies whether owners must be teams.
OwnersMustBeTeams bool `envconfig:"default=false"`
}
type ValidSyntax ¶ added in v0.8.0
type ValidSyntax struct{}
ValidSyntax provides a syntax validation for CODEOWNERS file.
If any line in your CODEOWNERS file contains invalid syntax, the file will not be detected and will not be used to request reviews. Invalid syntax includes inline comments and user or team names that do not exist on GitHub.
func NewValidSyntax ¶ added in v0.8.0
func NewValidSyntax() *ValidSyntax
NewValidSyntax returns new ValidSyntax instance.
func (ValidSyntax) Name ¶ added in v0.8.0
func (ValidSyntax) Name() string