Back to / galley / pkg / config / analysis

Package analysis

Latest Go to latest

The latest major version is .

Published: Aug 6, 2020 | License: Apache-2.0 | Module:


type Analyzer

type Analyzer interface {
	Metadata() Metadata
	Analyze(c Context)

Analyzer is an interface for analyzing configuration.

type CombinedAnalyzer

type CombinedAnalyzer struct {
	// contains filtered or unexported fields

CombinedAnalyzer is a special Analyzer that combines multiple analyzers into one

func Combine

func Combine(name string, analyzers ...Analyzer) *CombinedAnalyzer

Combine multiple analyzers into a single one. For input metadata, use the union of the component analyzers

func (*CombinedAnalyzer) Analyze

func (c *CombinedAnalyzer) Analyze(ctx Context)

Analyze implements Analyzer

func (*CombinedAnalyzer) AnalyzerNames

func (c *CombinedAnalyzer) AnalyzerNames() []string

AnalyzerNames returns the names of analyzers in this combined analyzer

func (*CombinedAnalyzer) Metadata

func (c *CombinedAnalyzer) Metadata() Metadata

Metadata implements Analyzer

func (*CombinedAnalyzer) RemoveSkipped

func (c *CombinedAnalyzer) RemoveSkipped(colsInSnapshots, disabledInputs collection.Names, xformProviders transformer.Providers) []string

RemoveSkipped removes analyzers that should be skipped, meaning they meet one of the following criteria: 1. The analyzer requires disabled input collections. The names of removed analyzers are returned. Transformer information is used to determine, based on the disabled input collections, which output collections should be disabled. Any analyzers that require those output collections will be removed. 2. The analyzer requires a collection not available in the current snapshot(s)

type Context

type Context interface {
	// Report a diagnostic message
	Report(c collection.Name, t diag.Message)

	// Find a resource in the collection. If not found, nil is returned
	Find(c collection.Name, name resource.FullName) *resource.Instance

	// Exists returns true if the specified resource exists in the context, false otherwise
	Exists(c collection.Name, name resource.FullName) bool

	// ForEach iterates over all the entries of a given collection.
	ForEach(c collection.Name, fn IteratorFn)

	// Canceled indicates that the context has been canceled. The analyzer should stop executing as soon as possible.
	Canceled() bool

Context is an analysis context that is passed to individual analyzers.

type IteratorFn

type IteratorFn func(r *resource.Instance) bool

IteratorFn is used to iterate over a set of collection entries. It must return true to keep iterating.

type Metadata

type Metadata struct {
	Name string
	// Description is a short explanation of what the analyzer checks. This
	// field is displayed to users when --list-analyzers is called.
	Description string
	Inputs      collection.Names

Metadata represents metadata for an analyzer

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier