Documentation ¶
Overview ¶
package v0 processes files, subtracting away only the functions declared in the file. These functions can be defined through a function declaration syntax or as an inline definition in a variable declaration.
package templater contains the templating functionality used to convert a general request body template into a body specific to a particular request.
Index ¶
- Constants
- func AddEvaluator(s ...StatementEvaluator) func(*ruleSet)
- func AddMatcher(m ...Matcher) func(*ruleSet)
- func AddNode(name any, new *node) func(*node)
- func AddRuleSet(r ...*ruleSet) func(*ruleSet)
- func AddStatement(statements *statements) func(*node)
- func ErrorsToRecord(errs []Error) [][]string
- func Format(node StatementNode, depth Depth) [][]string
- func NewNode(options ...func(*node)) *node
- func NewRuleSet(options ...func(*ruleSet)) *ruleSet
- func NewStatements(covered int, total int) *statements
- func Open(name string) (io.WriteCloser, error)
- func ParseOptions(global StatementEvaluator, options ...Option) (*ruleSet, error)
- func Ratio(statements Statements) float64
- type ArgType
- type CommandArgument
- type CommandSurface
- type Comparable
- type Context
- type CoverageBelowThresholdError
- type Depth
- type Error
- type ErrorFileOutputter
- type ErrorOutputter
- type Evaluator
- type ExactMatcher
- type ExactPairMatcher
- type ExcludeCommand
- type Executor
- type FallbackCommand
- type FileContext
- type FileFactory
- type FileInstance
- type FileParent
- type FileProcessor
- type Files
- type Filter
- type Flusher
- type FlusherBuilder
- type FunctionParent
- type Functions
- type GenericWriter
- type Global
- type GlobalOption
- type IndexMatcher
- type InvalidCommandArgumentTypeError
- type InvalidCommandArgumentValueTypeError
- type InvalidMinimumArgumentError
- type Level
- type MarkDownTemplate
- type MarkdownOutputter
- type Matcher
- type MinimumCommand
- type MockExecutor
- type MockRenderer
- type MultiFileOutputter
- type NamePair
- type Node
- type NoopCommand
- type NoopMatcher
- type NoopReader
- type NoopRenderer
- type OSFileFactory
- type Option
- type Outputter
- type PackageContext
- type PackageInstance
- type Packages
- type ProfileReader
- type RecordFileOutputter
- type RecordOutputter
- type RecordWriter
- type RegexpMatcher
- type RuleSet
- type StatementEvaluator
- type StatementNode
- type Statements
- type TabWriterBuilder
- type TemplateExecuter
- type TemplateExecutorFactory
- type TemplateFactory
- type TemplateRenderer
- type TemplateWriter
- type TemplateWriterFactory
- type Templater
- type Writer
- type WriterFactory
Constants ¶
View Source
const ( MarkdownFileName = "coverage_report.md" MarkdownTemplate = `` /* 928-byte string literal not displayed */ )
View Source
const ( BlockCovTableFile = "block_coverage_table.txt" FileCovTableFile = "file_coverage_table.txt" PackageCovTableFile = "package_coverage_table.txt" ErrorsFile = "coverage_errors.txt" )
Variables ¶
This section is empty.
Functions ¶
func AddEvaluator ¶
func AddEvaluator(s ...StatementEvaluator) func(*ruleSet)
func AddMatcher ¶
func AddMatcher(m ...Matcher) func(*ruleSet)
func AddRuleSet ¶
func AddRuleSet(r ...*ruleSet) func(*ruleSet)
func AddStatement ¶
func AddStatement(statements *statements) func(*node)
func ErrorsToRecord ¶ added in v0.2.2
func Format ¶
func Format(node StatementNode, depth Depth) [][]string
func NewRuleSet ¶
func NewRuleSet( options ...func(*ruleSet), ) *ruleSet
func NewStatements ¶
func ParseOptions ¶
func ParseOptions( global StatementEvaluator, options ...Option, ) (*ruleSet, error)
func Ratio ¶
func Ratio(statements Statements) float64
Types ¶
type CommandArgument ¶
type CommandSurface ¶
type CommandSurface interface { Parent() (CommandSurface, bool) Command() CommandArgument }
type Comparable ¶
type Comparable interface { Level Statements }
type Context ¶
type Context[T CommandSurface] interface { Filter[T] CommandSurface }
type CoverageBelowThresholdError ¶
type CoverageBelowThresholdError struct {
// contains filtered or unexported fields
}
func (*CoverageBelowThresholdError) Error ¶
func (err *CoverageBelowThresholdError) Error() string
type Error ¶ added in v0.2.2
func Validate ¶ added in v0.2.2
func Validate(node StatementNode, place ...string) []Error
func ValidatePreviousStatements ¶ added in v0.2.2
func ValidatePreviousStatements(statements Statements, place []string) []Error
type ErrorFileOutputter ¶ added in v0.2.5
type ErrorFileOutputter struct { Writer RecordWriter Open func(name string) (io.WriteCloser, error) Validate func(node StatementNode, place ...string) []Error ErrorsToRecord func(errs []Error) [][]string }
func NewErrorOutputter ¶ added in v0.2.5
func NewErrorOutputter(options ...func(*ErrorFileOutputter)) *ErrorFileOutputter
func (*ErrorFileOutputter) WriteOut ¶ added in v0.2.5
func (output *ErrorFileOutputter) WriteOut(name string, node StatementNode) error
type ErrorOutputter ¶ added in v0.2.5
type ErrorOutputter interface {
WriteOut(name string, node StatementNode) error
}
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
func CreateEvaluator ¶
func NewEvaluator ¶
type ExactMatcher ¶
type ExactMatcher struct {
// contains filtered or unexported fields
}
func NewExactMatcher ¶
func NewExactMatcher(match string) *ExactMatcher
func (*ExactMatcher) Match ¶
func (matcher *ExactMatcher) Match(matches any) bool
type ExactPairMatcher ¶
type ExactPairMatcher struct {
// contains filtered or unexported fields
}
func NewExactPairMatcher ¶
func NewExactPairMatcher(pair NamePair) *ExactPairMatcher
func (*ExactPairMatcher) Match ¶
func (matcher *ExactPairMatcher) Match(matches any) bool
type ExcludeCommand ¶
type ExcludeCommand struct{}
func NewExcludeCommand ¶
func NewExcludeCommand() *ExcludeCommand
func (*ExcludeCommand) Apply ¶
func (command *ExcludeCommand) Apply(old Statements) Statements
type Executor ¶ added in v0.2.5
func NewExecutor ¶ added in v0.2.5
type FallbackCommand ¶ added in v0.2.5
type FallbackCommand struct {
// contains filtered or unexported fields
}
func NewFallbackCommand ¶ added in v0.2.5
func NewFallbackCommand(fallback StatementEvaluator) *FallbackCommand
func (*FallbackCommand) Apply ¶ added in v0.2.5
func (command *FallbackCommand) Apply(statements Statements) Statements
type FileContext ¶
type FileContext interface { FunctionParent CommandSurface }
type FileFactory ¶ added in v0.2.5
type FileFactory interface {
NewFile() (io.WriteCloser, error)
}
type FileInstance ¶
type FileInstance interface { CommandSurface FunctionParent Method(receiver string, name string) CommandSurface Function(name string) CommandSurface Literal(index int) CommandSurface }
type FileParent ¶
type FileParent interface {
Files() Files
}
type FileProcessor ¶
type FileProcessor struct {
// contains filtered or unexported fields
}
func NewFileProcessor ¶
func (*FileProcessor) Process ¶
func (processor *FileProcessor) Process() []*declarations.Decl
type Filter ¶
type Filter[T CommandSurface] interface { Filter(string) T }
type FlusherBuilder ¶
type FunctionParent ¶
type FunctionParent interface {
Functions() Functions
}
type Functions ¶
type Functions Context[CommandSurface]
func AllFunctions ¶
func AllFunctions() Functions
type GenericWriter ¶ added in v0.2.5
type GlobalOption ¶ added in v0.2.3
type GlobalOption func() ([]*ruleSet, error)
type IndexMatcher ¶
type IndexMatcher struct {
// contains filtered or unexported fields
}
func NewIndexMatcher ¶
func NewIndexMatcher(index int) *IndexMatcher
func (*IndexMatcher) Match ¶
func (matcher *IndexMatcher) Match(matches any) bool
type InvalidCommandArgumentTypeError ¶
type InvalidCommandArgumentTypeError struct {
// contains filtered or unexported fields
}
func (*InvalidCommandArgumentTypeError) Error ¶
func (err *InvalidCommandArgumentTypeError) Error() string
type InvalidCommandArgumentValueTypeError ¶
type InvalidCommandArgumentValueTypeError struct {
// contains filtered or unexported fields
}
func (*InvalidCommandArgumentValueTypeError) Error ¶
func (err *InvalidCommandArgumentValueTypeError) Error() string
type InvalidMinimumArgumentError ¶
type InvalidMinimumArgumentError struct {
// contains filtered or unexported fields
}
func (*InvalidMinimumArgumentError) Error ¶
func (err *InvalidMinimumArgumentError) Error() string
type MarkDownTemplate ¶ added in v0.2.5
type MarkdownOutputter ¶ added in v0.2.5
type MarkdownOutputter struct { WriterFactory WriterFactory Format func(node StatementNode, depth Depth) [][]string Validate func(node StatementNode, place ...string) []Error ErrorsToRecord func(errs []Error) [][]string }
func NewMarkdownOutputter ¶ added in v0.2.5
func NewMarkdownOutputter(options ...func(*MarkdownOutputter)) *MarkdownOutputter
func (*MarkdownOutputter) WriteOut ¶ added in v0.2.5
func (outputter *MarkdownOutputter) WriteOut(node StatementNode) error
type MinimumCommand ¶
type MinimumCommand struct {
// contains filtered or unexported fields
}
func NewMinimumCommand ¶
func NewMinimumCommand(minimum float64) (*MinimumCommand, error)
func (*MinimumCommand) Apply ¶
func (command *MinimumCommand) Apply(statements Statements) Statements
type MockExecutor ¶ added in v0.2.5
type MockRenderer ¶ added in v0.2.5
type MultiFileOutputter ¶ added in v0.2.5
type MultiFileOutputter struct { ErrorsFile string BlockCovTableFile string FileCovTableFile string PackageCovTableFile string RecordsOut RecordOutputter ErrorsOut ErrorOutputter }
func NewMultiFileOutputter ¶ added in v0.2.5
func NewMultiFileOutputter(options ...func(*MultiFileOutputter)) *MultiFileOutputter
func (*MultiFileOutputter) WriteOut ¶ added in v0.2.5
func (outputter *MultiFileOutputter) WriteOut(node StatementNode) error
type NoopCommand ¶
type NoopCommand struct{}
func NewNoopCommand ¶
func NewNoopCommand() *NoopCommand
func (*NoopCommand) Apply ¶
func (command *NoopCommand) Apply(statements Statements) Statements
type NoopMatcher ¶
type NoopMatcher struct{}
func NewNoopMatcher ¶
func NewNoopMatcher() *NoopMatcher
func (*NoopMatcher) Match ¶
func (matcher *NoopMatcher) Match(matches any) bool
type NoopReader ¶ added in v0.2.5
type NoopReader struct{}
func (*NoopReader) Close ¶ added in v0.2.5
func (*NoopReader) Close() error
type NoopRenderer ¶ added in v0.2.5
type NoopRenderer[T any] struct { }
type OSFileFactory ¶ added in v0.2.5
func NewOSFileFactory ¶ added in v0.2.5
func NewOSFileFactory(options ...func(*OSFileFactory)) *OSFileFactory
func (*OSFileFactory) NewFile ¶ added in v0.2.5
func (factory *OSFileFactory) NewFile() (io.WriteCloser, error)
type Option ¶
type Option func() ([]*ruleSet, error)
func Exclude ¶
func Exclude(surfaces ...CommandSurface) Option
func Fallback ¶ added in v0.2.5
func Fallback(min float64, surfaces ...CommandSurface) Option
func Min ¶
func Min(min float64, surfaces ...CommandSurface) Option
type Outputter ¶ added in v0.2.5
type Outputter interface {
WriteOut(node StatementNode) error
}
type PackageContext ¶
type PackageContext interface { FileParent FunctionParent CommandSurface }
type PackageInstance ¶
type PackageInstance interface { CommandSurface FileParent FunctionParent File(name string) FileInstance }
func Package ¶
func Package(name string) PackageInstance
type Packages ¶
type Packages Context[PackageContext]
func AllPackages ¶
func AllPackages() Packages
type ProfileReader ¶
type ProfileReader struct {
// contains filtered or unexported fields
}
func NewProfileReader ¶
func NewProfileReader( root string, profile string, name string, ) *ProfileReader
func (*ProfileReader) CreateNodeTree ¶
func (reader *ProfileReader) CreateNodeTree() (Node, error)
type RecordFileOutputter ¶ added in v0.2.5
type RecordFileOutputter struct { Writer RecordWriter Open func(name string) (io.WriteCloser, error) Format func(node StatementNode, depth Depth) [][]string }
func NewRecordOutputter ¶ added in v0.2.5
func NewRecordOutputter(options ...func(*RecordFileOutputter)) *RecordFileOutputter
func (*RecordFileOutputter) WriteOut ¶ added in v0.2.5
func (output *RecordFileOutputter) WriteOut(name string, node StatementNode, depth Depth) error
type RecordOutputter ¶ added in v0.2.5
type RecordOutputter interface {
WriteOut(name string, node StatementNode, depth Depth) error
}
type RecordWriter ¶ added in v0.2.5
type RegexpMatcher ¶
type RegexpMatcher struct {
// contains filtered or unexported fields
}
func NewRegexpMatcher ¶
func NewRegexpMatcher(matchString func(s string) bool) *RegexpMatcher
func (*RegexpMatcher) Match ¶
func (matcher *RegexpMatcher) Match(matches any) bool
type RuleSet ¶
type RuleSet interface { Children(name any) RuleSet StatementEvaluator }
type StatementEvaluator ¶
type StatementEvaluator interface {
Apply(Statements) Statements
}
type StatementNode ¶
type StatementNode interface { Statements Children() map[any]StatementNode }
type Statements ¶
type Statements interface { Covered() int Total() int Valid() error Previous() Statements }
type TabWriterBuilder ¶
type TabWriterBuilder struct { Writer func(output io.Writer, minwidth int, tabwidth int, padding int, padchar byte, flags uint) *tabwriter.Writer MinWidth int TabWidth int Padding int Padchar byte Flags uint }
func NewTabWriterBuilder ¶
func NewTabWriterBuilder(options ...func(*TabWriterBuilder)) *TabWriterBuilder
type TemplateExecuter ¶ added in v0.2.5
type TemplateExecutorFactory ¶ added in v0.2.5
type TemplateExecutorFactory struct { Template string CreateExecutor func(content string) (*Executor, error) }
func NewTemplateExecutorFactory ¶ added in v0.2.5
func NewTemplateExecutorFactory(options ...func(*TemplateExecutorFactory)) *TemplateExecutorFactory
func (*TemplateExecutorFactory) NewExecutor ¶ added in v0.2.5
func (factory *TemplateExecutorFactory) NewExecutor() (TemplateExecuter, error)
type TemplateFactory ¶ added in v0.2.5
type TemplateFactory interface {
NewExecutor() (TemplateExecuter, error)
}
type TemplateRenderer ¶ added in v0.2.5
TemplateRenderer is an interface with a Render method. Render converts a generic to an io.Reader, or an error.
type TemplateWriter ¶ added in v0.2.5
type TemplateWriter[T any] struct { Exec TemplateExecuter File io.WriteCloser }
func NewTemplateWriter ¶ added in v0.2.5
func NewTemplateWriter[T any]( Exec TemplateExecuter, File io.WriteCloser, ) *TemplateWriter[T]
func (*TemplateWriter[T]) Write ¶ added in v0.2.5
func (writer *TemplateWriter[T]) Write(t T) error
type TemplateWriterFactory ¶ added in v0.2.5
type TemplateWriterFactory[T any] struct { TemplateFactory TemplateFactory FileFactory FileFactory CreateWriter func(Exec TemplateExecuter, File io.WriteCloser) *TemplateWriter[T] }
func NewWriterFactory ¶ added in v0.2.5
func NewWriterFactory[T any](options ...func(*TemplateWriterFactory[T])) *TemplateWriterFactory[T]
func (*TemplateWriterFactory[T]) NewWriter ¶ added in v0.2.5
func (factory *TemplateWriterFactory[T]) NewWriter() (GenericWriter[T], error)
type Templater ¶ added in v0.2.5
type Templater[T any] struct { // contains filtered or unexported fields }
Templater is a wrapper struct around the functionality of the golang wrapper.
func NewTemplater ¶ added in v0.2.5
func NewTemplater[T any](templ TemplateExecuter) *Templater[T]
NewTemplater creates a new Templater. It must be given a template in the form of a string as a parameter.
type Writer ¶
type Writer struct { Builder FlusherBuilder Delim string }
type WriterFactory ¶ added in v0.2.5
type WriterFactory interface {
NewWriter() (GenericWriter[MarkDownTemplate], error)
}
Click to show internal directories.
Click to hide internal directories.