Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chefe/gitlabcodeowners
A golang library to parse and query a CODEOWNERS file from Gitlab.
https://github.com/chefe/gitlabcodeowners
codeowners gitlab gitlab-codeowners
Last synced: about 1 month ago
JSON representation
A golang library to parse and query a CODEOWNERS file from Gitlab.
- Host: GitHub
- URL: https://github.com/chefe/gitlabcodeowners
- Owner: chefe
- License: mit
- Created: 2023-12-31T12:32:37.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-31T15:45:58.000Z (about 1 year ago)
- Last Synced: 2024-11-07T07:51:50.215Z (3 months ago)
- Topics: codeowners, gitlab, gitlab-codeowners
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Go Report Card](https://goreportcard.com/badge/github.com/chefe/gitlabcodeowners)](https://goreportcard.com/report/github.com/chefe/gitlabcodeowners)
[![GitHub Actions](https://github.com/chefe/gitlabcodeowners/workflows/default/badge.svg)](https://github.com/chefe/gitlabcodeowners/actions/workflows/default.yml?query=branch%3Amain)
[![Go Reference](https://pkg.go.dev/badge/github.com/chefe/gitlabcodeowners.svg)](https://pkg.go.dev/github.com/chefe/gitlabcodeowners)# gitlabcodeowners
```go
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\(\) \[\]string](<#GetPossibleCodeOwnersLocations>)
- [type Approval](<#Approval>)
- [type File](<#File>)
- [func NewCodeOwnersFile\(reader io.Reader\) \(File, error\)](<#NewCodeOwnersFile>)
- [func \(f File\) GetRequiredApprovalsForFile\(path string\) map\[string\]Approval](<#File.GetRequiredApprovalsForFile>)
- [func \(f File\) GetRequiredApprovalsForFiles\(paths \[\]string\) map\[string\]\[\]Approval](<#File.GetRequiredApprovalsForFiles>)
## func [GetPossibleCodeOwnersLocations]()```go
func GetPossibleCodeOwnersLocations() []string
```GetPossibleCodeOwnersLocations returns a list of possible locations where a \`CODEOWNERS\` file can be located according to Gitlab.
Approval describes an approval required by a rule in the \`CODEOWNERS\` file.
```go
type Approval struct {
Pattern string
Approvals int
Owners []string
}
```File is a representation of a parsed \`CODEOWNERS\` file.
```go
type File struct {
// contains filtered or unexported fields
}
```
### func [NewCodeOwnersFile]()```go
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]()```go
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]()```go
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]()