report

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package report provides different formats, i.e views on rule validation results that are printed to the provided io.Writer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssembleSummaryBody

func AssembleSummaryBody(findingsMap FindingsMap, printOptions PrintOptions, strBuilder *strings.Builder)

AssembleSummaryBody prepares the extension to Verbosity::short, be listing each lint rule violation. Format is 'LineNum | RuleID | RuleDefinition'/ Verbosity::normal = Verbosity::short + this summary body.

func AssembleSummaryHeader

func AssembleSummaryHeader(findingsMap FindingsMap, hasViolation bool, printOptions PrintOptions,
	strBuilder *strings.Builder)

AssembleSummaryHeader prepares the one line short summary header. Verbosity::short.

func PrintResultAsJSON

func PrintResultAsJSON(ruleValidationResultArray []RuleSet.RuleValidationResult, writer io.Writer)

PrintResultAsJSON prints lint rule violations to writer in JSON format.

func PrintSummary

func PrintSummary(violations []RuleSet.RuleValidationResult, writer io.Writer, options SummaryOption)

PrintSummary prints the RuleValidationResult list's summary using the provided writer and options.

Types

type FindingsMap

type FindingsMap map[RuleSet.Severity][]RuleSet.RuleValidationResult

FindingsMap shorthand for map[RuleSet.Severity][]RuleSet.RuleValidationResult.

func GroupFindings

func GroupFindings(findings []RuleSet.RuleValidationResult) (FindingsMap, bool)

GroupFindings groups lint rule violations based on their Severity.

type Padding

type Padding int

Padding type represents the padding strategy.

type PrintOptions

type PrintOptions struct {
	LineNumStrWidthTarget int
	PrintOptionsForSeverityMap
}

PrintOptions represents finer grain, printing specific options.

type PrintOptionsForSeverityMap

type PrintOptionsForSeverityMap map[RuleSet.Severity]struct {
	// contains filtered or unexported fields
}

PrintOptionsForSeverityMap is a mapping between severity levels, their serialized string and color function.

type SummaryOption

type SummaryOption struct {
	NoColor   bool
	Verbosity VerbosityLevel
}

SummaryOption holds the global settings for the summary.

type VerbosityLevel

type VerbosityLevel int

VerbosityLevel represent the verbosity level used in the summary below. For details please see the Verbosity* const definitions.

const (
	VerbosityShort  VerbosityLevel = iota // just a quick, one line summary
	VerbosityNormal                       // default verbosity level: position, rule ID and rule definition
	VerbosityHigh                         // normal verbosity extended with further information
)

Jump to

Keyboard shortcuts

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