bufbreaking

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package bufbreaking contains the breaking change detection functionality.

The primary entry point to this package is the Handler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllCheckers

func GetAllCheckers(categories ...string) ([]bufcheck.Checker, error)

GetAllCheckers gets all known checkers for the given categories.

If categories is empty, this returns all checkers as bufcheck.Checkers.

Should only be used for printing.

Types

type Checker

type Checker interface {
	bufcheck.Checker
	// contains filtered or unexported methods
}

Checker is a checker.

type Config

type Config struct {
	// Checkers are the checkers to run.
	//
	// Checkers will be sorted by first categories, then id when Configs are
	// created from this package, i.e. created wth ConfigBuilder.NewConfig.
	Checkers            []Checker
	IgnoreIDToRootPaths map[string]map[string]struct{}
	IgnoreRootPaths     map[string]struct{}
}

Config is the check config.

func (*Config) GetCheckers

func (c *Config) GetCheckers(categories ...string) ([]bufcheck.Checker, error)

GetCheckers returns the checkers for the given categories.

If categories is empty, this returns all checkers as bufcheck.Checkers.

Should only be used for printing.

type ConfigBuilder

type ConfigBuilder struct {
	Use                           []string
	Except                        []string
	IgnoreIDOrCategoryToRootPaths map[string][]string
	IgnoreRootPaths               []string
}

ConfigBuilder is a config builder.

func (ConfigBuilder) NewConfig

func (b ConfigBuilder) NewConfig() (*Config, error)

NewConfig returns a new Config.

type Handler

type Handler interface {
	// BreakingCheck runs the breaking checks.
	//
	// The image should have source code info for this to work properly. The previousImage
	// does not need to have source code info.
	//
	// Images should be filtered with regards to imports before passing to this function.
	//
	// FileAnnotations will use the image file paths, if these should be relative, use
	// FixFileAnnotationPaths.
	BreakingCheck(
		ctx context.Context,
		breakingConfig *Config,
		previousImage *imagev1beta1.Image,
		image *imagev1beta1.Image,
	) ([]*filev1beta1.FileAnnotation, error)
}

Handler handles the main breaking functionality.

func NewHandler

func NewHandler(
	logger *zap.Logger,
	breakingRunner Runner,
) Handler

NewHandler returns a new Handler.

type Runner

type Runner interface {
	// Check runs the breaking checkers, returning a system error if any system error occurs
	// or returning the FileAnnotations otherwise.
	//
	// previousFiles do not need to have Locations, and BreakingCheckers cannot rely on this.
	//
	// FileAnnotations will be sorted, but Paths will not have the roots as a prefix, instead
	// they will be relative to the roots. This should be fixed for linter outputs if image
	// mode is not used.
	Check(context.Context, *Config, []protodesc.File, []protodesc.File) ([]*filev1beta1.FileAnnotation, error)
}

Runner is a runner.

func NewRunner

func NewRunner(logger *zap.Logger) Runner

NewRunner returns a new Runner.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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