summary

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package summary generates summary reports in various formats.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileCoverage

func FileCoverage(f coverfile.File) float64

FileCoverage returns a File's coverage percentage between 0 and 1

func FormatPercent

func FormatPercent(f float64) string

FormatPercent formats a percentage of 0 to 1 with ABC.X% magnitude and precision

func New

func New(uncoveredFiles []coverfile.File, targetCoverage uint, format Format) string

New generates a new summary report in the given format

Types

type Format

type Format int

Format represents a summary report's format

const (
	FormatColorTerminal Format = iota
	FormatMarkdown
)

Supported formats

func (Format) Colorize

func (f Format) Colorize(c *color.Color, s string) string

Colorize returns 's' and optionally wraps with color 'c' according to the format's rules

func (Format) ColorizeStatus

func (f Format) ColorizeStatus(status coverstatus.Status, s string) string

ColorizeStatus returns 's' and optionally wraps with the coverage status's color according to the format's rules

func (Format) FormatTable

func (f Format) FormatTable(tbl table.Writer) string

FormatTable returns a formatted table according to the format's rules

func (Format) Monospace

func (f Format) Monospace(s string) string

Monospace returns a monospaced string according to the format's rules. Markdown uses code blocks with non-breaking spaces to ensure proper spacing.

func (Format) StatusIcon

func (f Format) StatusIcon(status coverstatus.Status) string

StatusIcon returns a coverage status icon according to the format's rules. Markdown returns an emoji, terminal returns empty string.

Jump to

Keyboard shortcuts

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