Documentation ¶
Overview ¶
Package pretty provides a pretty-printer for analyses.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // ShowCompilers is true if compiler breakdowns should be shown. ShowCompilers bool // ShowCompilerLogs is true if compiler logs should be shown. ShowCompilerLogs bool // ShowOk is true if subjects with the 'ok' status should be shown. ShowOk bool // ShowPlanInfo is true if plan metadata should be shown. ShowPlanInfo bool // ShowSubjects is true if subject information should be shown. ShowSubjects bool // ShowMutation is true if mutation testing information should be shown. ShowMutation bool }
Config is the type of pretty-printer configuration.
type Option ¶
type Option func(*Printer)
Option is the type of options for a pretty-printer.
func ShowCompilerLogs ¶
ShowCompilerLogs sets whether the printer should show compiler metadata, according to show.
func ShowCompilers ¶
ShowCompilers sets whether the printer should show compiler information, according to show.
func ShowMutation ¶
ShowMutation sets whether the printer should show mutation testing results, according to show.
func ShowOk ¶
ShowOk sets whether the printer should show subjects in the 'ok' category, according to show.
func ShowPlanInfo ¶
ShowPlanInfo sets whether the printer should show plan metadata, according to show.
func ShowSubjects ¶
ShowSubjects sets whether the printer should show subject breakdowns, according to show.
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer provides the ability to output human-readable summaries of analyses to a writer.
func NewPrinter ¶
NewPrinter constructs a pretty-printer using options o.
func (*Printer) OnAnalysis ¶
OnAnalysis writes an unsourced analysis a to this printer; if an error occurs, it tries to rescue.
Example ¶
ExamplePrinter_OnAnalysis is a testable example for Printer.OnAnalysis.
package main import ( "context" "fmt" "github.com/c4-project/c4t/internal/plan" "github.com/c4-project/c4t/internal/plan/analysis" "github.com/c4-project/c4t/internal/stage/analyser/pretty" ) func main() { p := plan.Mock() a, err := analysis.Analyse(context.Background(), p) if err != nil { fmt.Println("analysis error:", err) return } pw, err := pretty.NewPrinter(pretty.ShowCompilers(true)) if err != nil { fmt.Println("printer init error:", err) return } pw.OnAnalysis(*a) }
Output: # Compilers ## clang - style: gcc - arch: x86 - opt: none - mopt: none ### Times (sec) - compile: Min 200 Avg 200 Max 200 - run: Min 0 Avg 0 Max 0 ### Results - Ok: 1 subject(s) ## gcc - style: gcc - arch: ppc.64le.power9 - opt: none - mopt: none ### Times (sec) - compile: Min 200 Avg 200 Max 200 - run: Min 0 Avg 0 Max 0 ### Results - Flagged: 1 subject(s) - CompileFail: 1 subject(s)
func (*Printer) WriteSourced ¶
func (p *Printer) WriteSourced(a director.CycleAnalysis) error
WriteSourced writes a sourced analysis a to this printer.
type WithConfig ¶
type WithConfig struct { // Data is the wrapped data. Data interface{} // Config is the configuration. Config Config }
WithConfig is the type of things wrapped with pretty-printer config.
func AddConfig ¶
func AddConfig(x interface{}, c Config) WithConfig
AddConfig wraps the item x with the config c.