gitlabcodeowners

package module
v0.0.0-...-618e609 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2023 License: MIT Imports: 8 Imported by: 0

README

Go Report Card GitHub Actions Go Reference

gitlabcodeowners

import "github.com/chefe/gitlabcodeowners"

Package gitlabcodeowners provides parsing and querying function to work with `CODEOWNERS` file from Gitlab. See https://docs.gitlab.com/ee/user/project/codeowners for more details.

Index

func GetPossibleCodeOwnersLocations

func GetPossibleCodeOwnersLocations() []string

GetPossibleCodeOwnersLocations returns a list of possible locations where a `CODEOWNERS` file can be located according to Gitlab.

type Approval

Approval describes an approval required by a rule in the `CODEOWNERS` file.

type Approval struct {
    Pattern   string
    Approvals int
    Owners    []string
}

type File

File is a representation of a parsed `CODEOWNERS` file.

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

func NewCodeOwnersFile
func NewCodeOwnersFile(reader io.Reader) (File, error)

NewCodeOwnersFile tries to parse the given description and returns a `File` instance if parsing succeeded otherwise it return an error.

func (File) GetRequiredApprovalsForFile
func (f File) GetRequiredApprovalsForFile(path string) map[string]Approval

GetRequiredApprovalsForFile returns a map of all approvals which apply to the file given by it's path. All path need to start with a `/` which represents the root folder of the repository.

func (File) GetRequiredApprovalsForFiles
func (f File) GetRequiredApprovalsForFiles(paths []string) map[string][]Approval

GetRequiredApprovalsForFiles returns a map of all approvals which apply to the files given by their path. All paths need to start with a `/` which represents the root folder of the repository.

Generated by gomarkdoc

Documentation

Overview

Package gitlabcodeowners provides parsing and querying function to work with `CODEOWNERS` file from Gitlab. See https://docs.gitlab.com/ee/user/project/codeowners for more details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPossibleCodeOwnersLocations

func GetPossibleCodeOwnersLocations() []string

GetPossibleCodeOwnersLocations returns a list of possible locations where a `CODEOWNERS` file can be located according to Gitlab.

Types

type Approval

type Approval struct {
	Pattern   string
	Approvals int
	Owners    []string
}

Approval describes an approval required by a rule in the `CODEOWNERS` file.

type File

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

File is a representation of a parsed `CODEOWNERS` file.

func NewCodeOwnersFile

func NewCodeOwnersFile(reader io.Reader) (File, error)

NewCodeOwnersFile tries to parse the given description and returns a `File` instance if parsing succeeded otherwise it return an error.

func (File) GetRequiredApprovalsForFile

func (f File) GetRequiredApprovalsForFile(path string) map[string]Approval

GetRequiredApprovalsForFile returns a map of all approvals which apply to the file given by it's path. All path need to start with a `/` which represents the root folder of the repository.

func (File) GetRequiredApprovalsForFiles

func (f File) GetRequiredApprovalsForFiles(paths []string) map[string][]Approval

GetRequiredApprovalsForFiles returns a map of all approvals which apply to the files given by their path. All paths need to start with a `/` which represents the root folder of the repository.

Directories

Path Synopsis
Package testhelper contains utilities for testing.
Package testhelper contains utilities for testing.

Jump to

Keyboard shortcuts

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