coverage

package module
v0.0.0-...-60d670b Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: MIT Imports: 6 Imported by: 0

README

codeowners-coverage

Actions Status codecov Go Report Card GoDoc

Installation

go get github.com/aaronsky/codeowners-coverage/cmd/codeowners-coverage

Usage

As a Package
import (
    "fmt"
    "github.com/aaronsky/codeowners-coverage"
)

func getMyReport(path string) error {
	report, err := coverage.NewCoverageReport(path)
	if err != nil {
		return err
    }

	jsonString, err := report.ToFormat(coverage.ReportFormatJSON)
	if err != nil {
		return err
    }

    fmt.Println(jsonString)
}
CLI

codeowners-coverage also has a CLI. It works by loading a local Git repository, parsing its CODEOWNERS file, and crawling the disk for matches. To run, simply provide a path to a Git repository.

codeowners-coverage ~/go/src/github.com/docker/compose

In the event of a successful navigation, this will print JSON to stdout describing the coverage attributes of the repository.

License

This package is licensed under the MIT License.

Documentation

Overview

Package coverage will generate a coverage report for CODEOWNERS in the repository.

Index

Constants

View Source
const (
	// ReportFormatJSON is a constant representing the JSON format for a Report object
	ReportFormatJSON reportFormat = "json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Report

type Report struct {
	RemoteURL         string  `json:"remote_url"`
	SHA               string  `json:"sha"`
	CoveredFilesCount int     `json:"covered_files_count"`
	TotalFilesCount   int     `json:"total_files_count"`
	CoverageRatio     float64 `json:"coverage_ratio"`
}

Report contains information on the codeowner coverage of files in a repository

func NewCoverageReport

func NewCoverageReport(path string) (*Report, error)

NewCoverageReport produces a coverage report from the given repository Modifies state of the given repository by performing a git-clean.

func (*Report) ToFormat

func (r *Report) ToFormat(format reportFormat) (string, error)

ToFormat converts the report to a string in the given format. Currently only "json" is supported.

Directories

Path Synopsis
cmd
codeowners-coverage
Package main is the command line interface to package coverage
Package main is the command line interface to package coverage
internal
codeowners
Package codeowners contains logic for loading and parsing patterns in CODEOWNERS files
Package codeowners contains logic for loading and parsing patterns in CODEOWNERS files
git
Package git wraps functionality in the go-git package to manipulate Git repositories
Package git wraps functionality in the go-git package to manipulate Git repositories

Jump to

Keyboard shortcuts

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