Documentation
¶
Index ¶
- Constants
- func AddChildrenFlag(cmd *cobra.Command)
- func AddGroupFlag(cmd *cobra.Command)
- func AddPolicyFileFlag(cmd *cobra.Command)
- func AddRepositoriesFileFlag(cmd *cobra.Command)
- func Execute()
- type LicenseRule
- type PolicyError
- type PolicyFile
- type Repo
- type RepositoriesFile
- type RepositoryDefinition
- type RepositoryGroup
- type UserPermission
Constants ¶
const ( ERR_ACCESS_EXTRA = "The user/team '%s' is present and shouldn't be." ERR_ACCESS_MISSING = "The user/team %s is not defined." ERR_ACCESS_DIFFERENT = "The user/team '%s' should have the permission '%s', not '%s'." ERR_BRANCH_DEFAULT = "The default branch should be '%s', not '%s'." ERR_LABEL_EXTRA = "The label '%s' is present and shouldn't be." ERR_LABEL_MISSING = "The label '%s' is missing." ERR_LICENSE_DIFFERENT = "The license should be one of '%s', not '%s'." ERR_LICENSE_MISSING = "The license is missing." ERR_CO_DIFFERENT = "The CODEOWNERS file is different from the policy." ERR_CO_MISSING = "The CODEOWNERS file is missing." ERR_CO_SYNTAX = "The CODEOWNERS file has syntax errors:\n%s" )
Variables ¶
This section is empty.
Functions ¶
func AddChildrenFlag ¶ added in v0.8.0
func AddGroupFlag ¶ added in v0.8.0
func AddPolicyFileFlag ¶ added in v0.5.0
func AddRepositoriesFileFlag ¶ added in v0.5.0
Types ¶
type LicenseRule ¶ added in v0.2.0
type PolicyError ¶ added in v0.7.0
type PolicyError struct {
// contains filtered or unexported fields
}
Represents a error when applying a policy, with contextual information.
func (PolicyError) Error ¶ added in v0.7.0
func (this PolicyError) Error() string
Properly print out a policy error.
type PolicyFile ¶ added in v0.5.0
type PolicyFile struct {
DefaultBranch string `yaml:"defaultBranch"`
Archived bool `yaml:"archived"` // include archived repos in lookup?
License *LicenseRule `yaml:"license"`
Labels []string `yaml:"labels"`
LabelStrategy string `yaml:"labelStrategy"`
Access []UserPermission `yaml:"access"`
AccessStrategy string `yaml:"accessStrategy"`
CodeOwners string `yaml:"codeowners"`
}
type RepositoriesFile ¶ added in v0.6.0
type RepositoriesFile []*RepositoryGroup
============================================================================= A repositories.yml file =============================================================================
func (RepositoriesFile) Group ¶ added in v0.6.0
func (this RepositoriesFile) Group(groupName string) (*RepositoryGroup, error)
Get a group from a repositories file.
func (*RepositoriesFile) RepositoriesByGroup ¶ added in v0.6.0
func (this *RepositoriesFile) RepositoriesByGroup(group string) []RepositoryDefinition
Gets repositories from a repositories.yml file by group. The only group supported at this time is 'all'.
type RepositoryDefinition ¶ added in v0.5.0
type RepositoryGroup ¶ added in v0.6.0
type RepositoryGroup struct {
Group string `yaml:"group"`
Repositories []RepositoryDefinition `yaml:"repositories"`
Children RepositoriesFile `yaml:"children,omitempty"`
}
============================================================================= A list of repositories belonging to a group, the top-level object in a repositories.yml file. =============================================================================
func (*RepositoryGroup) Add ¶ added in v0.6.0
func (this *RepositoryGroup) Add(repoDef RepositoryDefinition)
Add a repository to the group
func (*RepositoryGroup) GetRepositories ¶ added in v0.8.0
func (this *RepositoryGroup) GetRepositories(listChildren bool) []RepositoryDefinition
Returns the repositories belong to the group. The parameter decides if to include children or not.
func (*RepositoryGroup) HasChildren ¶ added in v0.6.0
func (this *RepositoryGroup) HasChildren() bool
func (*RepositoryGroup) ListRepositories ¶ added in v0.8.0
func (this *RepositoryGroup) ListRepositories(listChildren bool) []string
Returns the list of URLs for each repository in this group. The parameter decides if to include children or not.
type UserPermission ¶
func (*UserPermission) GetUsername ¶ added in v0.9.0
func (this *UserPermission) GetUsername() string
func (*UserPermission) IsTeam ¶ added in v0.9.0
func (this *UserPermission) IsTeam() bool
func (*UserPermission) IsUser ¶ added in v0.9.0
func (this *UserPermission) IsUser() bool
func (*UserPermission) Org ¶ added in v0.9.0
func (this *UserPermission) Org() string
func (*UserPermission) SlashPos ¶ added in v0.9.0
func (this *UserPermission) SlashPos() int