themes

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

TODO kehuishu001

Index

Constants

View Source
const ProjectURL = "https://github.com/matm/gocov-html"

ProjectURL is the project's site on GitHub.

Variables

This section is empty.

Functions

func HTMLReportCoverage

func HTMLReportCoverage(r io.Reader, opts ReportOptions) error

HTMLReportCoverage outputs an HTML report on stdout by parsing JSON data generated by axw/gocov. The css parameter is an absolute path to a custom stylesheet. Use an empty string to use the default stylesheet available.

func Use

func Use(name string) error

Use takes the name of the theme that will be used for rendering. Returns an error for an unknown theme.

Types

type Beautifier

type Beautifier interface {
	// Name is the name of the theme.
	Name() string
	// Description is a single line comment about the theme.
	Description() string
	Assets() StaticAssets
	// Template is the structure of the page that will be rendered.
	// This code is generated by pkg/theme/generator.go.
	Template() *template.Template
	// PackageTemplate is the structure of the page that will be rendered.
	PackageTemplate() *template.Template
	// Data is the content used by the template.
	// This code is generated by pkg/theme/generator.go.
	Data() *templateData
}

Beautifier defines a theme used for rendering the HTML coverage stats.

func Current

func Current() Beautifier

Current returns the theme to use for rendering HTML.

func Get

func Get(name string) Beautifier

Get a theme by name. Returns nil if none found.

func List

func List() []Beautifier

List returns all available themes.

type ReportOptions

type ReportOptions struct {
	// LowCoverageOnTop puts low coverage functions first.
	LowCoverageOnTop bool
	// Stylesheet is the path to a custom CSS file.
	Stylesheet string
	// CoverageMin filters out all functions whose code coverage is smaller than it is.
	CoverageMin uint8
	// CoverageMax filters out all functions whose code coverage is greater than it is.
	CoverageMax uint8
	// ReportPath is the path to the package report dir.
	ReportPath string
}

ReportOptions holds various options used when generating the final HTML report.

type StaticAssets

type StaticAssets struct {
	Stylesheets []string
	Scripts     []string
	Index       string
}

StaticAssets sets all assets required for a theme.

Jump to

Keyboard shortcuts

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